Date: March 17 2017
Instructor: Professor Mikesell
Author: Andrew Huang
Materials used: Breadboard, buzzer, wires, Arduino, 10k resistor
Processing to Arduino
Our first part of the part of the project was to get the buzzer to go off when the mouse is pressed in processing. This code was somewhat trivial, since we already had the code from yesterday where we made the LED light up from clicking the square in Processing and Arduino. Modifying it to buzz was simply a matter of using the tone() function. After that, we decided to proceed onto the Arduino to processing.
Arduino to Processing
The second part of the lab involved us using the serial port to turn the square darker when the button was pressed. This part of the lab was more tricky for us, due to the fact that I omitted the crucial while loop that told me whether or not the port was available. Due to that fact, we got really weird values, such as negative ones; values that we originally did not write to the serial port. From that, we realized that our code somewhat mirrored our first exercises, and after help from an instructor, we figured the code out and got the button to work properly.
This lab provided good intuition on how to use Serial to use processing to talk to Arduino, and vise versa. It also told me crucially, that the ports have to be available for either of them to read their values, otherwise, the values that come out are not coherent.