Serial Communication with Flash and Processing

October 8th, 2008 | BY JASON SAFIR

The concept of serial communication adds a whole other dimension to what you can do with the Arduino microcontroller. Communication with other applications is essential for the type of projects I would like to develop at ITP, especially for those that involve interactive video and technological live performance pieces. My excitement in learning the technical aspects of serial communication encouraged me to experiment with with two dynamic programming environments that I enjoy working with: Flash and Processing. The above images is a graph designed in ActionScript 3 that senses and reads the output values from two potentiomotor’s.  Very useful in analyzing the behavior of inputs!

Next, for fun I wanted to create a simple application in Flash that changes the color of canvas based on values generated from an analog sensor (in this case a pot). Unlike with Processing, to communicate with Flash you need to marshal between a network and a serial port using the serial proxy terminal. You also need an Actionscript library that sends/receives Arduino commands over a network socket (this is built in into Processing). Here I imported the as3glue library, it works great!

The source code for my little color changing application with a potentiometer.

In Flash, I also experimented with send commands with the Arduino. Here I am toggling an LED on/off with my mouse which is acting as a push button switch.

Experimenting with Tom Igoe’s sensor reading values graph in Processing. Establishing serial communication with Processing  is a lot simpler than with Flash, but is still a useful envioronment to consider in some cases, such as controlling a timeline with an anlaog input. For next week’s serial communication lab, I will experiment with Max/MSP!