We finally married the Arduino and .p5js together. I feel like some Phil Collins would be appropriate right now. Serial communication is pretty finicky. There are so many opportunities for bugs to show up, but the end result is pretty awesome.
I sent the serial data from the potentiometer on my breadboard, and I mapped it to some scale values in my P5 sketch. Pretty cool, right? Also, that’s my cat, Henry, and this video was filmed by my wife, Marina.
I did a lot of work cleaning up the noise of the potentiometer. When I first started running my sketch with serial, the planets would be jittery when the potentiometer was at rest and it was driving me crazy. I did two things to clean up the voltage output. One is that I put a 10K resistor in between the potentiometer and the Analog pin on the Arduino. This helped pretty significantly, but still not enough. I did some research online and I found forum about it (Click here for link).
This is what it ends up looking like. The way I understand it is that it takes two readings simultaneously and uses the reading that has the least amount of variance compared to the previous reading. It looks like this:
We also started scheming for our midterm project this week. We were teamed up to make collaborative projects. I’m with Mingxi Xu. Our plan is to make a dance game using large FSR’s as sensors to detect your dance moves and send that data to a P5 sketch. Our hope is to be able to have one player dance, and program the game so that the next player has to copy the first player’s dance moves.
These are the FSRs we will use (click here for link):
We had to special order some larger, more heavy duty FSRs, which arrived yesterday. We’ll have to figure out how to connect those sensors to our P5 sketch in serial, design the physical dance board on the floor, program the visual appearance of the program, and most importantly, program the mechanism by which P5 records one player’s dance moves and compares them to the other. That will probably be the most difficult part. More on that next week….