In this recitation, I used the code resources provided in the serial communication folder. The first exercise was to create an Etch a Sketch by sending the Arduino values from two potentiometers to Processing. While it was rather simple to do this with a circle, I wanted a smoother line to make it as close to a real Etch a Sketch as possible. After doing some research online for reference code, I learned that in order to get the line function to work properly, I had to set up variables for a previous X and Y. The video of it working properly is shown below:

The second exercise in this recitation was to make the Arduino control servo motors on each side of the computer screen, where a ball moves from one side to the other. Creating the code to move the ball from one side of the screen to the other was rather simple. However, I met difficulty in making the servo motors act according to the code. One of the motors kept vibrating rather than moving at the 90-degree angle my code directed it to do. As it turns out, this was due to an issue with the delay. Once I added a delay, it moved properly. The result was not perfect, but due to time constraints, I was unable to make the movement of the motors smoother, but the result is shown below:

Homework
The homework for this recitation was to make a circuit that has two buttons and make them interact with the code in Processing to make rotating shapes appear and disappear by pressing the buttons. I first set up the buttons on my breadboard and wrote the code to produce the rotating shapes in Processing. I decided to make these components separate initially to ensure that both sides of the project were working properly. Connecting the two proved to be much more difficult, as I was able to get the shapes to appear for the duration of the button being pressed down, but coding it to be a toggle switch was harder than I had expected. I finally got it to work properly after using a combination of if-statements and while-loops. It is intermittent at times, but I consider it to be mostly a success. A video of this project is shown below:

Leave a Reply