Introduction to SunSpot development using NetBeans for Newbies
By Ashwin Bhat K S and Rajath Shanbag
Some really cool online resources before you read the wiki
Instructions to build a simple demo Sun SPOT application in NetBeans.
- Install the latest JDK
- Insert the cd given with the sunspot and run SunSPOTSDKInstaller.jar
- Just double click the jar file. If it does not open try the following command in the shell or command prompt
java –jar SunSPOTSDKInstaller.jar
- Click “Continue” button, Scroll to the bottom and click "Accept"
- Put a tick mark to the necessary items to be installed. Select a location for installing the software.
- If you already have a JDK you will see that Supported JDK found message. You need not put a tick mark against JDK in that case.
- And then select "Install"
- Accept the license agreement and select "Next >"
- Select all the components and select "next"
- Click next
- Again click "next" and wait for some time. In the end click "Finish".
- Say "Next”", Accept the license terms ,give an appropriate installation directory and select an appropriate JVM from the list and finally say finish. This will finish Netbeans 5.5 Installation.
- Press "Continue"
- Press "Start IDE"
- NetBeans 5.5 will now open with a Welcome screen showing various Information and resources about the sunspot.Browse through the excellent resources for more information.
- Now connect one end of a USB cable to a standalone SUNSPOT ( Thicker of the two SUNSPOTS ) and other end to your computer and follow instructions to install the USB Driver.
- Click "Next"
- Click "Continue Anyway"
- Now we are Ready to deploy our first SUNSPOT Application
- Go to “File -> Open Project” in the menu bar.
- Go to the “Demos” Folder In the SUNSPOT Installation Directory.
- Here it is C:\Program Files\Sun\SunSPOT\Demos
- Click on AirText in the Demos folder
- Click on the “Open Project Folder Button”
- Now AirText is listed in the projects Window.
- Click on AirTextDemo.java file in the Project Explorer.
- In the Right Hand Side In the Editor Window. You can edit the message and the colour to be Shown.
- This Demo will show "HI This is a Sun SPOT SPOT SPOT SPOT SPOT"
- The Function swingThis( ) will display the string given as arguments when the SUNSPOT is swung to and fro.
- The Function setColor will set the color in terms of RGB.
- Now in the Project Explorer Right Click on AirText and click "Build Project + Deploy to Sun SPOT"
- In the Output window you will see similar to what is shown below.
"Waiting for target to synchronise..."
"(Please reset SPOT if you dont get a prompt)"
- Do wait for sometime and Then press the power button of the SUNSPOT which will restart / reset the SPOT.
- Make sure you get the Encircled message after resetting the SPOT.
- Congratulations. You have deployed your first Application on your SUNSPOT.
- Now Swing the SUNSPOT to and fro.
- The accelerometer inside the SUNSPOT will detect the movement and the LEDs will give an effect of displaying the message .
- Similarly try the other demos and write an application of your own.
- Happy Programming :)
See also SUNSPOTwithNetbeans