Recitation 8: Documentation by Robin Luo

Lab Date:  April 19, 2019
Instructor: Marcela

Aim of Today’s Lab: Create an Etch A Sketch and a musical instrument with Arduino and Processing with serial communication

Building Etch A Sketch

Materials Used: Jumper Cables, 2 potentiometers, Arduino Uno, Arduino -> Processing Files

Process:
I always approach projects by splitting them into small checkpoints so I can make sure every step I have tested has worked up to that point. For this Etch A Sketch, I first checked if my potentiometers were working. To do this, I used the AnalogSerial example to see if I can get one potentiometer working. Afterwards, I set up two potentiometers to see if I can get the serial information from them through the Arduino serial monitor. Once I got that working (by only supplying the serial monitor with 2 sensor values), I incorporated Processing. I ran into one issue which was forgetting to change the port index into Arduino’s point. Once I changed the num of values to the corresponding values, I checked if Processing could receive information from both elements of the sensorValues so I printed them out in the console. 

Then, I built the sketch. Initially, I used ellipses as the drawing tool, but I noticed how scattered it was, so I eventually decided to create a set of points and connect them. To do this, I decided to use PVector class, beginShape and endShape functions, and an ArrayList. I added points to my ArrayList by creating PVector objects and drawing the “shape” I created by iterating through the ArrayList by connecting the vertices (or points). 

 

Building a Musical Instrument

Materials Used: Arduino Uno, Jumper Cables, Speaker/Buzzer, Processing -> Arduino Files

Process:
Once I got the speaker working with toneMelody, I used the Processing -> Arduino files to create the musical instrument. This process was slightly tricky seeing how the values array correlated in Processing, so I first decided to see if I could get a single tone output from the speaker when I clicked the Processing canvas. Once I got that working, I attempted to see if I could get the single tone output to play on and off when I clicked my mouse. Then to create the instrument, I got the speaker to change pitch when I moved my mouse. 

Conclusion
This recitation was great now since I have combined both Processing and Arduino, connecting both hardware and software! Some things I learned to keep note: check if the size of the array is equal on both Arduino and Processing, check Port Index, and check if serial communication is occurring between both Arduino and Processing.

Leave a Reply