Java Solaris Communities Partners My Sun Sun Store United States Worldwide
»   Introduction
»  A Short Tour of a Sun SPOT
»   The Ectoplasmic Bouncing Ball Demo
    Loading and Running the Air Text Demo (current page)
»   Changing the Air Text Demo
» Basestation in Action
 
Sun SPOT Quick Start Tutorial

Loading and Running The Air Text Demo

 
 

Now, lets try downloading another demo to a Sun SPOT. That will give you an idea of how to download Java programs to a Sun SPOT

Compile, Deploy and Run the Demo

  1. Within NetBeans, navigate to the Sun SPOT directory and then the Demos subdirectory. On a windows workstation, the absolute file path is usually C:/Program Files/Sun/SunSPOT/Demos. Open the project which is in the [SunSPOTdirectory]/Demos/AirText directory. Make sure "Open as Main Project" is selected, then click on the "Open Project Folder" button.

NetBeans projects are simply folders with a NBProject folder in them. You can look at any of the files with ordinary editors.

  1. Clean and build this project. You can do this either by right-clicking on the project (control-click for a Macintosh) and selecting "Clean and Build Project" as shown below...

or you can select the "Build" menu from the main menu bar and select "Clean and Build Project" from that menu:

After you command the system to clean and build the project, you should see an output panel open at the bottom of the NetBeans window. The output panel will show the output from the compile operation. This text should end with "BUILD SUCCESSFUL" and the time it took to build the object code.

  1. Connect a free range Sun SPOT to the USB cable. Reset (or turn on) the free-range Sun SPOT by tapping the SPOT control button. The LED to the right will flash green during the synchronization.
  1. Select the project in the project window, right-click on it (control-click on a Macintosh), and select "deploy" from the pop-up menu. This will create a jar file from the compiled code and start to transfer it to the Sun SPOT.

.

The download operation will then pause with the words "Waiting for target to synchronize... (please reset SPOT if you don't get a prompt)". Just tap the control button to get the download to proceed. The LED to the right will flash green as the Sun SPOT attempts to synchronize with the host workstation.

If the deploy operation is successful, the output at the bottom of the NetBeans window will end with something like this:

If the words "Download operation completed successfully" do not appear, then the Sun SPOT is probably not synchronized with the host workstation. Try resetting the Sun SPOT again.


Troubleshooting: If you get output that looks like this:

If you see output that says "COM5 is in use" or "Port COMn unavailable..." that means that some other process is using the Sun SPOT and the deploy script can't write to it until that process is done with it. To fix this problem, you need to terminate the other Sun SPOT-related processes. Go to the upper left panel of the NetBeans window, where there are three tabs: Projects, Files and Runtime. Click on the Runtime tab.

Expand the "Processes" node. It will display a list of running processes.

Right clicking on a process will give you the option of terminating that process. Terminate all the processes. Click on the project tab again and try deploying the demo to the Sun SPOT again.


When you have successfully deployed the code to the Sun SPOT, turn the Sun SPOT off and disconnect the Sun SPOT from the USB cable. Now tap on the control button to start the demo.

Note: Nothing will happen happen after the reset. The LEDs on the sensor board will be off until you follow the directions below.

The Effect

This demo displays better in a darkened room, but anywhere that you can see the main string of eight LEDs will work. Hold the Sun SPOT up, with the radio antenna fin out to the left. Swing the Sun SPOT very quickly, as quickly as you can, from left to right and back again a few dozen times. Swing wide and fast. Go for a back and forth distance of one, two, or even three feet.

The Sun SPOT will sense the acceleration and will turn the LEDs on and off in such a way that your eyes will see words painted in the air by the Sun SPOT. The words will say "Hi!...This...is a...Sun...SPOT".

The next step is to modify the Air Text program and load the changed program on to a Sun SPOT.


Next: Changing the Air Text Demo

Back to top