Exercise 1:
For this exercise, we were required to use Arduino to send values to Processing. We had done some similar exercises during classes before this recitation class, so this exercise was not too difficult to complete. When we do the first part of this exercise that control the position of the circle, the circle would move out of the canvas if I directly use the values from the Arduino. Thus, I had to map the value between 0 and 500. As I moved to the second part to make the Etch A Sketch work, I found the difficulty to store the previous values of x coordinate and y coordinate. In this case, I reread the original code and found that I just needed to assign these two values before the updateValue function. Finally, I created another Etch A Sketch by using Arduino and Processing. But I cannot draw as well as what the video showed.
Exercise 2:
The second exercise required us to use Processing to send values to Arduino. We used the buzzer as the output of the exercise. And the values which were sent were the x coordinate and the y coordinate of the mouse, which are assigned as the frequency of the tone and the duration of the tone. At first, the tone would change as soon as you moved the mouse. Then, I added the interaction with the keyboard. In this case, only when you press the space key on the keyboard can the tone change. Since the tone wouldn’t change continuously, you can even play some melodies by moving the position of the mouse and pressing the space key. Maybe in the future, I would add more interactions with the keyboard to make it more interesting.
Code:
https://github.com/JooooosephY/Recitation-8