Working individually, you will complete the following exercises to send data from Arduino to Processing (and vice versa) using serial communication. You can find some example code that might help you here. Make sure to document each exercise, a schematic for each circuit that you make, and the interaction involved for each step.
Exercise 1: Make a Processing Etch A Sketch
For this exercise, use Arduino to send two analog values to Processing via serial communication. To do this, build a circuit with two potentiometers and write an Arduino sketch that reads their values and sends them serially. Then write a Processing sketch that draws an ellipse and reads those two analog values from Arduino. This sketch should modify the ellipse’s x and y values based on the input from Arduino. Just like an Etch A Sketch, one potentiometer should control the ellipse’s x-axis movement, and the other should control the ellipse’s y-axis movement. To see how an Etch A Sketch works, you can watch the video here.
Exercise 2: Make a musical instrument with Arduino
Write a Processing sketch that sends values to your Arduino based on your mouse’s x and y positions and/or keyboard interactions. Then, make a circuit with your Arduino and a buzzer. The corresponding Arduino code should read the serial values from Processing and translate them into frequency and duration for a tone, which will be sounded by the buzzer (hint: you can use the tone() function to achieve this) . Consider the video below as a starting point for designing this musical instrument.