Quick Start Tutorial
» Welcome & Introduction
» A Short Tour of a Sun SPOT
» The Ectoplasmic Bouncing Ball
» Loading & Running Air Text
> Changing the Air Text Demo
» Basestation in Action
» Send-Data & HTTP Demos

Sun SPOT Quick Start Tutorial

Changing the Air Text Demo

The Air Text demo is easy to change.

First, copy the existing project. Right-click on "AirText" and select "Copy Project" from the menu.

A NetBeans screenshot. The AirText project has been selected and the pop-up menu is displayed.  The cursor is positioned over the choice 'Copy Project'.

A dialog box will display. Enter a new name for your version of the project:

A dialog box screenshot. The dialog box is titled 'Copy Project.'  The input area lableld 'Project Name' has been filled in with the name 'AirText_New'. The cursor is positioned over a button reading 'Copy'.

Make your new project the current project by right-clicking on the project name and selecting "Set Main Project". In the Project window, click on the plus to the left of the project name to expand the project node. Now, expand the "src" node, then the "org.sunspotworld.demo" package. Select "AirTextDemo.java" from the files displayed. Open the file, either double-clicking on it or right-clicking on it and selecting "Open."

A NetBeans screenshot. In the upper left, the Files tab has been selected.  The active project is now 'AirText_New'.  It has been selected and the source (SRC) node has been expanded.  Under the source node, the node shown is 'org.sunspotworld.demo'.  Under that node, three source files are visible and on of them has been selected.  The selected source file is 'AirTextDemo.java'.  The beginning of that file are shown in an editor window to the right.

The source code for AirTextDemo.java will display in the window to the right. Scroll the window on the right down to lines 50 or so. There you will see a series of calls to disp.SwingThis. Change the string "Hi!" to "Yes!".

A NetBeans screenshot. The AirTextDemo.java file is open in the editor window and the window is scrolled a little bit more than half way through the file.  The source shown in the screenshot reads, in part, 'while (true) { disp.setColor(255,0,0); disp.swingThis('HI!', 17);'  The statement beginning 'disp.swingthis' is circled in the figure.

Now go through the steps previously outlined to deploy and run the new code. When you deploy, the system automatically saves and compiles your changes.

Unplug the Sun SPOT from the USB cable. Now move it back and forth in the air and see if your changes have made it onto the Sun SPOT and are running.

Congratulations! You have mastered the "Hello, world" application of Sun SPOTs!

Now we would like to show you how the Sun SPOT basestation can be used to connect to the free-range Sun SPOTs.


« Loading & Running AirTextBasestation in Action »