Recitation 7 – Serial Communication – Andres Malaga

Exercise 1:

I used two potentiometers, connected to pins A0 and A1. Each potentiometer sent a value to the Arduino, which sent both values in the form of an array to processing. In processing, I coded a canvas the size of the maximum value the potentiometers would give me (672, although it should be 1024) with a white background and a red circle with a fixed size. I coded the circle’s X coordinate to be the value obtained from A0 and made A1 be the Y coordinate. I only had the background in void setup so that it didn’t refresh every frame and the circle could move through the canvas giving the impression that it was drawing something. In this exercise, the interaction was done through the potentiometers, which dictated the position of the circle on the canvas.

Exercise 2:

I made a 1000 x 1000 canvas in processing, and coded for the mouse’s X coordinate to be the first value sent (Values [0]) and the mouse’s Y coordinate to be the second value sent (Values [1]). In Arduino, Values [0] would transform into the frequency of the tone played by a buzzer connected to pin 9, while values [1] would transform into the tone’s duration. In this exercise, the interaction was made through the mouse in processing, whose position would function as an input that would output a tone in the buzzer connected to the Arduino.

Leave a Reply