Processing Labs

Oscillating Circle with Processing

Questions:

  1. Processing is based on the Java language.
  2. 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.
  3. When called, the draw() function does not return a data type, as its return type is void.
  4. 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:

IMG_6310.jpg

My Code:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: