Oscillating Circle with Processing
Questions:
- Processing is based on the Java language.
- A global variable is declared outside of a function and can be accessible anywhere in a program, whilst a local variable is declared inside a function and can only be accessed inside that function.
- When called, the draw() function does not return a data type, as its return type is void.
- The code below the “//keep the circle in bounds” comment acts to make sure the ball does not move outside the bounds of the Processing window. It does so by checking the position of the ball, and if it is larger than the size of the window or lower than zero, the program reverses the direction of the ball.
Sending Serial Data from Arduino Circuit to a Processing Application
Etch-A-Sketch
Since I didn’t have an extra potentiometer, I used a force-sensitive resistor instead, which was a lot more sensitive to a light touch and thus proved more difficult in controlling the vertical direction.
The Circuit:
My Code: