Arduino control with Flash AS3

Technology

You can communicate from Flash to an Arduino device by using a proxy. The proxy runs on a machine which is connected directly to the Arduino with a serial connection. Your AS3 code talks to the proxy over a TCP socket, and the proxy talks to the Arduino over the serial connection.

This whole setup is made pretty simple by Erik Sjodin’s as3Glue library:

as3Glue is an ActionScript 3 library that enables communication between Flash/Flex/AIR applications and Arduino boards. It can together with one or several Arduino boards be used to monitor sensors (such as rotary encoders and motion detectors), control actuators (such as LEDs and motors) and interface other electronics (such as RFID readers) from Flash, Flex and AIR applications.

The library includes Arduino sketches and ActionScript 3 code examples as well as custom version of the Standard Firmata Arduino firmware and a serial proxy.

The AS3 portion of the library is released under the MIT license, and provides methods for setting pin modes and writing digital and analog data to pin output. It also provides event callbacks for receiving digital and analog data back from the device. The only wonky thing is that the proxy doesn’t appear to be released in source form (as far as I can tell), and it’s only provided as binaries for Windows and Mac users. On the bright side, it’s pretty easy to digest what’s happening from the Arduino.as file and the Standard Firmata protocol, so it wouldn’t be a huge ordeal to cobble together your own proxy if you know a little C or PERL.

as3Glue – Arduino control from Flash, Flex and AIR
SimpleIO.as – a decent AS3 Arduino example
Firmata – host machine to microcontroller communication protocol

What will the next generation of Make: look like? We’re inviting you to shape the future by investing in Make:. By becoming an investor, you help decide what’s next. The future of Make: is in your hands. Learn More.

Tagged
Discuss this article with the rest of the community on our Discord server!

ADVERTISEMENT

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 16th iteration!

Prices Increase in....

Days
Hours
Minutes
Seconds
FEEDBACK