Simple Flash Blink LED

Does anyone have any pointers on how to blink an LED using the flash time line? I'm trying to synch a flash video with actions happening on the time line and having trouble deciphering between the code necessary for arduino and flash to communicate and the code that makes things happen. I've checked out both Beltran and JModel's code but am having trouble pairing back everything they have going on and was hoping to be able to start with the basic blink and add functionality once I have that working.

Well...I tried stripping down JModel code from here... The code I'm uploading to the Arduino looks like so...

int activeLED ;              // What LED has Flash requested we turn on? Numbers 2-9, for a total of 8 possible LEDs


void setup() {
  Serial.begin(19200);  //setup serial conversation at 19200 bauds

void loop () {
//------------------------------------------------------------------------ LED LOGIC
  // checks if a serial message has arrived to the board
   if(Serial.available() > 0) {      
          //must be a request to light up an LED   
          //activeLED should be a number 2-9, but in binary it will come in as 50-57 
          activeLED =;
    if(activeLED = 60) {
      //a valid LED signal has been received from Flash
      // convert the byte to an int - getting ready for digitalWrite()
      int outputPort = activeLED-48;
      if(outputPort = 12) {
      int ledPin = 12;                 // LED connected to digital pin 12

      digitalWrite(ledPin, HIGH);   // sets the LED on
      delay(1000);                  // waits for a second
      digitalWrite(ledPin, LOW);    // sets the LED off
      delay(1000);                  // waits for a second 
      // when we're done, default the activeLED to nothing
      activeLED = 0;

  //slows down the visualization: each sentence will be emitted every .5 seconds


/*send to flash
* inspired by D.Mellis printString function. it simply adds the byte(0) at the end 
* needed by the XMLSocket to know that the transmission is over.
* read the XMLSocket Actionscript Class documentation for more details
void sendStringToFlash (char *s) {
      while (*s) {
        printByte(0); //notify the XMLSocket that the comunication is over

and this is my flash code...

//------------------------------------------------------------------------ Basic Arduino

import Arduino;

var port:Number = 5331;            // What socket port are we configured to use? 
                                          // See the net_port entries from serproxy.cfg

// Create a custom object from Flash's XMLSocket
var a:Arduino = new Arduino(port);

//------------------------------------------------------------------------ Listeners

// You can trigger custom actions by adding listners to the Arduino object. For example, you can setup your
// ActionScript code to run a setup function when Flash successfully connects to the socket listener

aListener = new Object();

aListener.onConnect = function() {

// Binds your custom listener to the Arduino object (a)

//------------------------------------------------------------------------ That's all!

function setupBoard() {
      trace("Connection established. Now setting up LED...");
            var i:Number = 12;
            function go() {
                  var pin = i.toString();

I've tried to double check the code and see if I can check where I may have made errors, but as of now, nothing happens when I run the code. Anyone have any suggestions?

If you're running this with Flash and serproxy open and your Arduino board plugged-in, you should be getting characters funneling through. One thing that looks immediately suspicious is the go() function embedded in the setupBoard() in Flash. It may work but you should double-check that your scope is right and that the a and i variables in go() are not undefined

What messages are you getting when you run a preview of your Flash movie? That's usually pretty telling

You may want to use Serial.print() and Arduino software's built-in serial monitor to run some debug outputs at points in the code, to make sure for example that it's getting past the Serial.available() check and into the actual LED logic.

If you haven't already, check all the usuals: proper connection with serproxy open, the port number for the board (based on serproxy.cfg), the right serial_device1 variable set in serproxy.cfg, etc.

If you're on a Mac, you can also try using the screen command in the Terminal to check that your serial connection is working. You would want to type something like this, where cu.usbserial-A2000g7e is whatever the ID of your board is:

ls -al /dev
ls -al /dev | grep cu
screen cu.usbserial-A2000g7e

I haven't used the screen command in a while so I may be forgetting something, but it can be handy