Arduino + Processing Demo
Prof. Victoria Bradbury

Terms

Firmata: A standard Arduino sketch that reads all of the Analog and Digital Pins from Arduino and reports them to software on your computer. This is a catch-all software and you don’t need to change it.

Serial: ‘The Serial library reads and writes data to and from external devices one byte at a time. It allows two computers (your Arduino and your computer for Ex.) to send and receive data.

Baud Rate: speed at which data is being sent across the serial port. I usually use 9600, which is pretty standard. How much this matters depends on balancing precision of reading your sensors with not wanting to crash your software.

Bytes: unit of digital information – serial data is sent in bytes.

Steps for Firmata Demo

  1. Setup your Arduino with an LED in pin 13 and ground and a breadboard with both a button (Digital Pin 2) and potentiometer (Analog Pin 0), like this:
  2. and this:

  3. Upload “Standard Firmata” onto your Arduino
  4. Import the “Arduino” Library in Processing from
    Sketch > Import Library
  5. Try out the “analog_arduino” sketch in your Processing Examples*
  6. Follow along with this tutorial by Paul Badger: http://playground.arduino.cc/Interfacing/ProcesssHackForFirmata
  7. Try the “arduino_output” sketch to light your LED by pushing the button in the sketch.
  8. * note that in Processing you may need to change which device is being read by changing the value in the brackets here (mine worked with 1 instead of 0): String portName = Serial.list()[0];

Steps for Serial Demo

  1. In this demo, a button makes changes to a color in a Processing sketch.
  2. In Processing, go to File > Examples > Libraries > SimpleRead
  3. Follow the instructions in this demo. Note that this require a button to be attached to Digital Pin 4 and that the Arduino code is commented out at the bottom of the Processing sketch. Copy and Paste this into Arduino and upload it to your board before you run the Processing sketch.

Additional Links

Arduino and Processing: http://playground.arduino.cc/Interfacing/Processing

Processing and Serial: https://processing.org:8443/reference/libraries/serial/index.html

Advanced Interactive Design: NM420