Recitation 8: Serial Communication (Alex Wang)

For this weeks recitation, we now merge both the Arduino and the Processing language to create a physical project with the capabilities to run code when connected to a computer. In order to connect the two, we communicate through the serial port, by writing and reading information on both ends.

Exercise1:

Our first exercise is to create a etch a sketch using potentiometers as control and feeding that data to processing where the image is drawn. At first I used the ellipse function to simulate the drawing, but the ellipse keeps jumping if the potentiometer value changes too quickly, I tried messing with the delay value but it does not seem to be smooth enough.

I then decided to use the line function instead to make sure the drawing is connected, but the parameter for the line function requires two sets of coordinates, I took care of this by storing the previous value inside a list before it refreshes and use that as the parameter for the line function and it looks much smoother.

Exercise2:

Our second task was to create an instrument with processing input and Arduino buzzer as output.

For minimal coding, I decided to send the key value to Arduino when the key is pressed, I modify the key value by subtracting it by 96 (ascii value for char ‘a’ is 97) and then multiplying that value by a certain frequency for each character on the keyboard to be a different tone. I set the default duration of the tone to 10, so that it gets a plucky sound.

Both exercises schematics below:

Conclusion:

I think the combination of Arduino and processing gives me so many more possibilities to what I can achieve, the transmission of data between the two programs are made much friendlier with the provided code and enables me to create projects that have similar structures to the two exercises we did in class. Either having Arduino sensors for input and processing visuals as output, or have processing mouse and keyboard as input, and have Arduino leds and buzzers as output. This gives me a lot more option to what I can achieve with these tools and also a lot of inspiration for my final project.

Leave a Reply