Arduino Analog Sensors: Push Button Monitoring

 

The simplest form of a changing analog reading might be the monitoring of a push button, held low by a pull down resistor. When the button is pressed the reading jumps to 255 as the analog pin reads 5V. This two state result could have been achieved with any of the digital pins, but it serves as an example nonethless.

Stripping the problem down to its most simplest form (having the Arduino place one of only two different byte values of 0 and 255 on the Serial port and retrieving them in Processing) is instructive for a number of reasons. Issues to gain familiarity with,

  1. The frequency of the data collection
  2. The difference between the Serial.print and Serial.write functions
  3. Can your Arduino and Processing applications access the Serial port at the same time?
  4. What is the best data model for Processing to use to accumulate the readings for presentation?
  5. What animation techniques could be employed in to have Processing present the model dynamically?
  6. Could you effectively use Processing as an oscilloscope for the Arduino?
  7. What options exist for creating animations outside of Processing like the one above?