This week our lab focused on gathering analog values (in this case from our potentiometer) and importing those values into Processing in order to have a visual representation for our changing values.
Here’s our basic potentiometer setup. The center pin is inputting value into the analog A0 pin. That information is then sent over to Processing.
The command: import processing.serial.*; is used to call the serial library in Processing and the line ” Serial myPort” declares a variable named myPort from class Serial.
The command: import processing.serial.*; is used to call the serial library in Processing and the line ” Serial myPort” declares a variable named myPort from class Serial.
inByte is the variable that will hold the incoming values from our analog source (our potentiometer). We can then use this variable to both print out the numeric value (ranging from 0 to 255), and we can use this variable in a range of visual outputs. In this function I have circles of different colors display based on the incoming analog values. Values 0-100 produces a black circle, 100-150 produces a range of blue circles, 150-200 a green circle, and over 200 a red circle. Here’s the video!
and…a beautiful pair of cutler and gross glasses.