實驗物理技術:2009/02-06
登入

http://www.arduino.cc/playground/Interfacing/Flash

Arduino and Flash

Overview

There are 4 main components needed to getting an Arduino to communicate with Flash:

  1. Code to run on the Arduino: This sends data over the USB virtual serial port.
  2. A Serial to Socket Server: This takes data from the serial port and sends it over a network socket. Designed to be used with any client software (Flash etc) and any microcontroller.
  3. A Flash Socket Library: Actionscript code in flash that accepts and interprets the data coming in from the network socket. You can do this yourself, but why? - most people use an existing codebase.
  4. Your Flash Code (and Sample code): You custom actionscript code that does something interesting with the data. Some resources have sample actionscript code so you can learn by example.

NOTE: All of this can also work in reverse - Flash can send data to Arduino.

Resources

These are below, under the four headings described above:

Code to run on the Arduino

You can either

  • Make your own, using commands from the 'Serial Communication' section of Arduino Reference (Serial.print and Serial.read etc).
  • Or use an existing code sample. Some of the resources here have code samples.

There are two Arduino codesets that will be listed here because they are more than just samples - they are designed to be all that you would ever need to upload to the Arduino, after which time, you can just send serial commands to the Arduino to change what it is doing for you.

  • Firmata. Worth serious consideration for most projects. Never upload code to Arduino again - just get your software to send commands that will get Arduino to do what you need. It is being developed as a pseudo-standard, so has support for many software libraries, including Flash 9 (ActionScript 3) - see 'Glue' later.
  • Arduino > Flash code from Stephen Wilson at SFSU. This is like a simple version of Firmata (above). Also here is a Code library for Director, but does not seem to have anything for Flash.

Serial to Socket Server

The list of Serial-to-Network Proxy Servers and details can be found here. Some of the resources here include or have been tested with certain servers. Common ones are:

  • serproxy. In my opinion, the best option. Simple, fast, robust. Not as simple as TinkerProxy though, so some beginners might want to start with...
  • TinkerProxy. The simplest to use, but also the least features and flexibility. Biggest problem is it can only receive serial data - NOT transmit serial data to the arduino.
  • SS6 Serial Server. Uses Java, which makes it platform independent, but unfortunately, Java does not support serial port communications without manually installing plugins. This makes it the hardest to set up, and quite slow. However, quite a few people have used this option.
  • Arduino2Flash. The author says "Some people using Intel Macs and OS X were unable to get serproxy configured correctly to connect Flash and the Arduino board. To work around this problem, I have written a replacement for serproxy in java called Arduino2Flash. This is experimental code, hacked together quickly, and probably buggy. Please test, let me know if it works, and I'll upload improved versions over time."

Flash Socket Library

  • Flash CS3 Binary Socket Example - Flash CS3 and Arduino sketch demonstrating connecting Flash to Arduino using the binary socket and TinkerProxy, from Brett Forsyth. While it has not been designed as a library, its code is short and can be easily used as a starting point.
  • Glue - Flex/ActionScript 3 class and sample code for Arduinos with Firmata, from Erik Sjodin.
  • Arduino > Flash tools from Beltran Berrocal. Uses serproxy. Includes:
    • The 'Arduino.as Actionscript Class v1.0 (30-12-2005)', which uses Actionscript 2.
    • A sample flash app using 'Arduino.as Actionscript Class v1.0'.
    • Info on flash communication handling multiple bytes.
  • 'Flash Arduino IO' - Arduino <> Flash Communication from Kasper Kamperman. Based on 'Arduino.as Actionscript Class v1.0' (AS2) and uses serproxy. A clear and effective implementation. A complete video tutorial (that explains the revised version) can be found at Vimeo.
    • Monitor and set inputs/outputs on Arduino with Flash.
    • Sources, documentation and Serialproxy included.
    • Download revised version (10-2008) zip : Flash Arduino IO 2
    • Download old version zip : Flash Arduino IO

This is a bit of an exception to the rule - it uses the 'Arduino.as Actionscript Class v1.0' library, but its implementation is so effective and thorough, it can also be used as a library to base a project on.

  • SS6 Serial Server by Dan O'Sullivan. Is the official site of the SS6 Serial Server. It provides a pretty simple 'SS6 Flash Library' (AS1) (under flash tips) that has become quite commonly used. It also provides flash sample code and Arduino sample code.
  • MIDAS Serial Component by Tek-Jin Nam & Ji-Dong Yim at Co.design:Inter.action Lab. in the department of Industrial Design, KAIST. It provides flash components (works with AS2.0 and AS3.0 in windows and Mac) to make connection between flash and arduino by serial ports. It also provides installation software and flash sample codes.

Your Flash Code (and Sample code)

  • Intro and samples for simple Flash <> Arduino from Jonah Model. Based on the work of Beltran Berrocal. So uses ''Arduino.as Actionscript Class v1.0' (AS2) and serproxy.
  • 'Arduino Vs Flash' Communication from Jowan Sebastian. Uses SS6 Serial Server and 'SS6 Flash Library'. Simple, customisable communication: DIY code + pics + downloads. Example uses:
    • 1 sensor into Flash to control a movie clip frame number.
    • Simple code that can be adapted to add more sensors.
    • USB / Serial Comm port and data gets pushed to Flash using Serial to Socket server.

0最後修改紀錄: 2009/04/14(Tue) 18:32:30


尚未登入. (登入)

since 2011/06/20 18:23