Posts Tagged ‘USB’

Accessing the USB port

Posted: August 18, 2010 in API
Tags: ,

The Arduino is an inexpensive, easy to find, open-source hardware prototyping platform.  You can connect a wide variety of sensors and other electronics to it, and then using the open-source as3glue “Physical Interaction Library for Flash” you can communicate via the USB port with Flash or AIR.
Arduino: http://www.arduino.cc/

as3glue: http://code.google.com/p/as3glue/

  1. Get an Arduino, a basic one goes for about US$30.  Download the driver and software for your OS from the “Download” section of the Arduino web site and install them.
  2. Download the as3glue files from the Google Code website.  It will include the installs for Standard Firmata and Serproxy that you need for later steps.  (Note: The Serproxy included is for Windows and Mac only.)
  3. Plug your Arduino into the USB port and upload the Standard Firmata.  This sets up the Arduino to use a standardized protocol for communicating with a host computer.
  4. Unplug your Arduino and connect up your sensor, probably to one of the analog input pins.
  5. Install Serproxy on your computer.  (Or another serial port proxy if you are not using Windows or Mac.  Sorry but I can’t help you with that.)  Serproxy will take the USB input from the Arduino and act as a serial server which your Flash or AIR app will open a Socket connection to.
  6. Plug the Arduino into your USB port, start Serproxy and you’re ready to use as3glue to receive the sensor’s output in Flash or AIR.  There are some example .fla files included in the as3glue download that show how to code this.
  7. Celebrate! 🙂
PS:  If you have a problem with loading the Standard Firmata that comes with as3glue onto your Arduino you may want to try a newer version, which you can download from the Firmata Wiki here http://firmata.org/wiki/Main_Page.