Marc Hughes


Home
Blog
Twitter
LinkedIn
GitHub
about
I am a developer from a bit west of Boston.

Arduino fun

07 Sep 2009

This morning I got to play with a recently purchased arduino board.  Let me tell you, these things are amazingly easy to use.  Everyone should give it a try at some point.  I'm not going to try to write a how-to or a tutorial right now, but let me illustrate just how easy this was.

1) Plug board into USB 2) Install Arduino software 3) Select example blink sketch (application) and upload

And suddenly you have a blinking LED (one is build onto the board).

So then I plugged in a little servo I had lying around, found the servo library.  Wrote a little sketch, and I was able to make the servo go to any position by communicating with my desktop computer over USB.  Total time, maybe half an hour.  Controlling servos isn't the easiest thing in the electronics world since you have to worry about timing signals & whatnot.  But Arduino boils all that down to 2 or 3 lines of code.  Wow.

So next I set off to grab as3glue, which includes a serial port/tcp gateway so you can control the arduino through flash.  After maybe 20 minutes of tinkering I have an amazing high level API I can use in flash to control the board. (I ended up using arduino2flash instead of serproxy since serproxy wouldn't work for me.)

Here's a little AS3 snippet that uses a utility class I wrote to control 4 LED's attached to the board from flash.

  arduino = new BuildBoardArduinoController();
TweenMax.to(arduino, 2, {led1:255, yoyo:0, ease:Quad.easeIn}); TweenMax.to(arduino, 2, {led2:255, yoyo:0, delay:1, ease:Quad.easeIn}); TweenMax.to(arduino, 2, {led3:255, yoyo:0, delay:2, ease:Quad.easeIn}); TweenMax.to(arduino, 2, {led4:255, yoyo:0, delay:3, ease:Quad.easeIn});

That code causes each LED to fade in and out over and over. Wow... tweening physical computing? Neat.

3896960836_fa12762040

I had long been thinking about tinkering with one of these. If you have too, just do it. $30 for the board, and an hour of your time will get something working.

Next up, building a Build Notification system that will read in our CruiseControl status at work and let people know what's going on.