The NETLab Toolkit is a series of open source components and a server application that allow you to communicate between your Lilypad and Flash animations, images, sounds and videos. You can also connect up a camera and use that as input. With an extra piece of software called Osculator you can also use the NETLab Toolkit to communicate between Flash objects and a wiimote or an iPhone or iPad. If you own Flash, you can download a copy of the toolkit and install it so that you can work at home.

Preparing the Lilypad for connection to the NETlab Toolkit

  1. Connect the Lilypad Mainboard to the computer (using FTDI breakout board and mini USB cable).Arduinoicon.png
  2. Open the Arduino application and make sure have selected Tools > Board > Lilypad Arduino w/ ATmega 328.
  3. Check also that the first usb serial connection is selected from the list under Tools > Serial Port.
  4. Open the Arduino Standard Firmata script by choosing Files > Examples > Firmata > StandardFirmata .
  5. Upload this script to your Lilypad by clicking the upload button at the top of the Arduino Firmata sketch window.
  6. Close the Arduino application.

Opening the NETLab Hub

  1. In Applications find the folder titled NETLabHub_2011_03_25_mac.NetlabHub_Icon.png
  2. Open this folder and Get Info ( command + i) on the NETLabHub application (look for the pink square icon). Make sure the box next to open in 32bit mode is checked (see pic below).
  3. Now double-click to open the NETLabHub application.
  4. This hub application needs to sit open in the background while you are working with the NETLab Toolkit in Flash. When you test your Flash movie and try to communicate with your Lilypad the hub will relay any messages between the Lilypad and Flash. You don't need to change any settings in the hub it just needs to be open.

Testing your Flash Lilypad connection

  1. Open Flash and open a new Actionscript 3 FLA document.DigitalOutParams.png
  2. The NETLab Toolkit provides a series of component widgets. To see these, open the components window within Flash by choosing Window > Components.
  3. Then open the components folder titled NETLabFlashWidgets_3_2_1. You add widgets to your Flash movie by dragging and dropping them onto your movie stage.
  4. To test our connection we are going to use the DigitalOut widget to make the LED on pin 13 of the Lilypad blink. Drag the DigitalOut widget from the component window onto your stage.
  5. Select the DigitalOut widget on the stage and open the Component Parameters section of the property inpector.
  6. Set the Controller to Arduino. Set the controllerOutputNum to 13 (i.e. pin 13 on the Lilypad). Leave all other settings at their defaults.
  7. Save the movie.
  8. Choose Control > Test Movie > In Flash Professional to test the movie.
  9. You control the NETLab widgets in test movie mode. The radio button in the top right hand corner of any NETLab widget turns the connection between the widget and the Lilypad Arduino on and off. Turn this widget connection on now by selecting this radio button (it should be orange like in pic below). Wait 30 seconds or so until you see the "Widget id0 connected" message (see pic below). The lights on the Lilypad will twinkle while the connection is being made.TestMovieBlink.png
  10. Once your connection is made you can then turn the LED on pin 13 of the Lilypad on or off by sending a message using the OUT radio button on the NETLab DigitalOut widget (the one at the bottom right corner of the widget in the black section). Try it out!

Using the AnalogIn Widget to read a sensor

  1. Connect one of the sensors (e.g. the touch sensor) to the Lilypad using the instructions on the other pages of this Wiki.AnalogIn.png
  2. Ensure the NETLab Hub is open and, if you haven't already, load Firmata onto the Lilypad (see above for instructions).
  3. Open a new actionscript 3 FLA file in Flash.
  4. From the Components window drag an instance of the AnalogIn widget onto the stage.
  5. Open the Component Parameters section of the property inspector and check that the Controller is set to Arduino.
  6. Set the controllerInputNum to match the analog pin number that you have connected your sensor to (e.g. 0).
  7. Save the movie.
  8. Choose Control > Test Movie > In Flash Professional to test the movie. Turn on the AnalogIn widget using the radio button in the top right corner. Wait for the twinkling lights to stop and then press the touch sensor. You will see the slider in the widget move up and down in response to your pressure. (Note: For some reason you do not get the connected message with this widget.)
  9. The top of the AnalogIn widget shows the values that are coming in from the sensor. The bottom shows the values that you are sending out from this widget. You can change the range of these output settings by changing the numbers next to max and min. For example, in the picture on the right the max has been set to 100. Change the numbers by selecting and then typing into this area while in test movie mode in Flash. The NETLab widgets remember any settings that you make in test movie mode. So the next time you test your movie after changing this setting it will still be set to 100.

Using the AnalogIn Widget to control a Flash Movieclip

  1. Use the same Flash movie and Lilypad setup as you used in the previous tutorial.
  2. Create a new movieclip symbol in Flash and create some kind of single frame graphic inside this movieclip (e.g. a circle, a flower, a person).
  3. Back in the main stage drag the movieclip symbol that you just created from the library onto the stage.movieclip.png
  4. Give this movieclip symbol an instance name in the property inspector e.g. myMovie.
  5. Select the AnalogIn widget on the stage and give this the instance name touch.
  6. Drag an instance of the ClipControl widget from the Component window onto the stage.
  7. Select the ClipControl widget on the stage and open the Component Parameters section of the property inspector. Set the Clip parameter to be the instance name of your movieclip e.g. myMovie. Set the InputSource to be the instance name of the AnalogIn widget e.g. touch.
  8. Save the movie.
  9. Choose Control > Test Movie > In Flash Professional to test the movie. Turn on the AnalogIn widget using the radio button in the top right corner. Wait for the twinkling lights to stop and then use the dropdown menu in the ClipControl widget to choose which aspect of your clip you want to adjust. For example, set the max to be the stage width (550) and then choose X from the dropdown menu. Now press the touch sensor.
  10. Have a play with the other settings in the dropdown menu. Note: you may need to adjust the max and min settings depending on which aspect of your clip you are adjusting.

Where to find out more

The NETLab Toolkit website has documentation on each of the widgets in the toolkit.
See this video for a demonstration of connecting between NetLab and the xBee. The video also demonstrates how to use the Tween It component to control an animation.