Exercise 1: Make a Processing Etch A Sketch
I first opened the example code called multi-value. Then I built the circuits by connecting the two potentiometers to the breadboard. Then in arduino code I changed the original number to 2 to match the two potentiometers. Then I run the arduino to check if the value change in potentiometers can be displayed in the arduino serial. After it worked, I opened the processing and created a circle in the draw() with a black background line of code at the beginning to avoid trace of drawing. I also linked the position of the circle to arduino sensor value by creating x and y.
Then I replaced the circle with line. To make it continuous, I delete the background at the beginning. The challenge is to avoid creating continuous straight lines. Inspired by what we’ve learned in class, I used the pMouseX and pMouseY to track the previous drawing. I also used a map function to ensure the lines moved inside the screen. The effect is shown as below. The potentiometers respectively control the movement along x and y axis.
Exercise 2: Make a musical instrument with Arduino
I built the circuits first by connecting the buzzer to the volt and the digital pin. Then like exercise 1 but in reverse order, I opened the processing first and changed the port and number of input to 2 because the variable is the frequency and duration of the buzzer. In processing I changed the input value to 2 too and also created a tone() function. tone (pinnumber, frequency, duration). Based on the principle, I linked the frequency and duration value to the value in two potentiometers. It worked like this!
The interaction is basically translating the analog value of the potentiometers to the values various different outputs. It enables interaction in various forms.