| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

TutorialFlashSetup

Page history last edited by PBworks 12 years, 9 months ago

Overview

In our tutorial, we will control sensors and actuators from Flash through the Arduino physical computing platform. Flash cannot talk directly to hardware so you'll have to install some extra pieces of software: an Actionscript library that sends/receives Arduino commands over a network socket; a proxy server that marshals between network and serial ports; and a hardware driver for the serial port on the Arduino board.

 

Before the Tutorial

Complete these steps BEFORE comming to the tutorial - we have a packed schedule and not enough time to walk everyone through the software setup. Email bjoern at stanford.edu if you are having problems with the setup.

 

  1. You need a working version of Adobe Flash CS3 Professional on your computer. Non-professional may work, but has not been tested. Earlier versions of Flash have not been tested, but we can guarantee that any version lacking Actionscript 3.0 will definitely not work. We've experienced some trouble with installing Flash CS3 Pro Trial on 32bit Vista. Here are instructions for correcting Internal Error 2739 during installation.
  2. Install the FTDI USB Serial driver for the USB chip on the Arduino board we will hand out: Windows executable, OS X >=10.4 on Intel Macs, OS X, Power PC or older Intels
  3. Download the as3glue library for Flash from our site (this version is NOT identical with the official version distributed on google code - we have fixed bugs and added functionality): as3glue-cs247-01.zip. Inside you will find a folder called "as3glue" and one called "cs247_examples". Extract both into your workspace (e.g., c:/code/ on a PC or /Users/yourusername/Documents on OS X) - remember where this directory is for the following steps.
  4. You'll first have to add the as3glue library to the classpath so Flash can find the files. Start Flash. On a PC: Go to Edit Menu->Preferences; on OSX, the Preferences dialog can be found under the "Flash" Menu. Within the Preferences dialog, click ActionScript->ActionScript 3.0 Settings...->"+" to add new directory to classpath. Click the crosshairs to find the as3glue/as3 folder. Confirm all dialogs. See a screencast of step 4.
  5. To test whether the library is now installed correctly, go through the following steps:
    1. Execute as3glue/applications/Serproxy-0.1.3-3/serproxy. On Vista, you have to unblock the program to give it permission to open a socket. On Mac OSX, you'll get a warning about launching a program downloaded from the internet. Again, you'll have to give permission.
    2. Open cs247_examples/test_arduino.fla in Flash. Run it.
    3. In Flash should display a message like this:
      Socket connected!
      Socket closed!
      
      The serproxy window should show something like this:
      Failed to open comm port - connection refused
      This means you're good to go - all that is missing is the hardware. View a Screencast of step 5.

 

Trroubleshooting:

If you get the following error in the Flash output window, serproxy is not running.

Error #2044: Unhandled IOErrorEvent:. text=Error #2031: Socket Error.
	at Untitled_fla::MainTimeline/Untitled_fla::frame1()

 

IF you get the following error in the Flash output window, Flash cannot find the as3glue library. Please check and repeat step 4. It seems that there might be a bug in Flash CS3 where settings get lost if you do not have an Actionscript file open when you change the settings.

1046: Type was not found or was not a compile-time constant:ArduinoEvent.

 

Once you have the hardware

To get data from your Arduino board into Flash, in addition to as3glue, you still need a program that takes data from the serial port and relays it via a TCP socket. A program called Serialproxy is included in the as3glue download in subdirectory as3glue/applications/Serproxy-0.1.3-3. There are both MAC and PC versions. The following are instructions for configuring Serproxy.

  1. Find out which serial port your Arduino board uses on your computer. First plug in your board.
    1. On Windows: Go to Control Panel->System->Hardware->Device manager, open tree node "Ports (COM & LPT)". Look for "USB Serial Port (COMx)". Note the value of x. If your COM port of your Arduino board is greater than COM9, you'll have to do some extra work (insert solution here).
    2. On Mac OSX: open a terminal and execute "ls /dev/cu.usb*". Look for an entry like "/dev/cu.usbserial-A1001NgZ". Note this name.
  2. Now edit as3glue/applications/Serproxy-0.1.3-3/serproxy.cfg.
    1. PC: On my machine, Arduino uses COM3 - this is reflected in the line comm_ports=3 and below. If your board is on COM4, you'd have to change those lines to comm_ports=4 and net_port4=5331. Here is the complete config file:
      # Config file for serproxy - PC Version
      
      # Do not Transform newlines coming from the serial port into nils
      newlines_to_nils=false
      
      # Comm ports used
      comm_ports=3
      
      # Default settings
      comm_baud=57600
      comm_databits=8
      comm_stopbits=1
      comm_parity=none
      
      # Idle time out in seconds
      timeout=300
      
      # Settings for COM3
      net_port3=5331
      
    2. Mac OSX: You'll have to change the line serial_device1=... and insert the name of the usbserial device you found in the previous step.
      # Config file for serproxy
      
      # Do not Transform newlines coming from the serial port into nils
      newlines_to_nils=false
      
      # Comm ports used
      comm_ports=1
      
      # Default settings
      comm_baud=57600
      comm_databits=8
      comm_stopbits=1
      comm_parity=none
      
      # Idle time out in seconds
      timeout=300
      
      serial_device1=/dev/cu.usbserial-A1001NgZ
      net_port1=5331

 

  1. Execute as3glue/applications/Serproxy-0.1.3-3/serproxy. On Vista, you have to unblock the program to give it permission to open a socket.
  2. Open cs247_examples/test_arduino.fla in Flash. Run it.
  3. In Flash should display a message like this:
    Socket connected!
    Firmware version: 1
    Port: 5331
    The serproxy window should show something like this:
    Server thread launched
    server(4) - thread started
    This means you're good to go. View a Screencast of a successful test.

Comments (1)

Gary Hill said

at 5:08 pm on May 11, 2009

This article includes the cryptic note:
On Vista, you have to unblock the program to give it permission to open a socket.
How do you "unblock the program to give it permission to open a socket."

You don't have permission to comment on this page.