Recitation 8: Serial Communication by Jennifer Cheung

For this recitation, I used serial communications to utilize both Arduino and Processing to use hardware and software interactions together.

In the first project, I made a Processing Etch-A-Sketch with Arduino potentiometers. I used the sample code for Arduino to Processing communications as a starting point, modifying the Processing code to map the posX and posY as width and height. On the breadboard, two potentiometers controlled the x axis and y axis movement. I then drew an ellipse moving across the screen, but the ellipses drawn were not continuous enough to come across as a line. So, I changed it to a line function, using prevPosX and prevPosY to remember the previous position of the line in order to make the line draw. Arduino code stayed the same. 

Schematic

Next, I used the Arduino to Processing sample code to make a music player with a buzzer on the breadboard. I used the mouse position of an ellipse to translate into sound frequency in Processing and linked it into the Arduino code. So, the tone would change based on where my mouse was on the canvas. Using an if/else statement in Processing, I was able to get the tone to play only when a key was pressed. 

Leave a Reply