Lab 1

Due Friday, 1/29 - 11:59pm

The goal of this lab is to get you started with Java and the SunSPOTs. You will need to download the development environment before beginning. You will then run several of the Demonstration programs to become familiar with the process of compiling and deploying programs to the SPOTs. Finally, you will develop some programs of your own.

Step 0

Make sure you are signed up for the mailing list at: https://cs.usfca.edu/mailman/listinfo/cs685

Step 1 - SDK and IDE Installation

    1. Begin by reading the Getting Started page and the SPOT Tour page on SunSPOTWorld.com.
    2. Install the SunSPOTManager.
      1. I recommend you simply download it from the Internet. You can install the SDK from the disk that may have been included with your kit, but the disk will install a deprecated version.
    3. When you first run the SPOTManager, it should prompt you to install NetBeans. It is recommended that you proceed with the installation of NetBeans and then go to this page to help you get the SunSPOT plugin set up: http://blogs.sun.com/davidgs/entry/netbeans_6_0_and_sun
      1. You can use other IDEs, such as Eclipse, for development, but NetBeans has much better support for the SPOTs. Using an IDE like Eclipse will require that you develop in the IDE and then use the command line for deployment, etc.
    4. Continue with the install of the SDK. Your SPOTs should have version Red-090706 of the SDK installed. It is recommend you install this version.
      1. If you are using OSX - Snow Leopard, red-090706 may not work. It is recommend that you install Red with Snow Leopard support.
      2. In the SDKs tab, select and install v.5.01.
      3. Upgrade your SPOTs and basestation to the newer SDK.
      4. When upgrading the basestation, make sure to start the basestation after the upgrade.
    5. You should now be set up to develop for the SunSPOTs!

Step 2 - Running the Demos

    1. Launch NetBeans.
    2. To run the Demos "as-is", select File -> Open Project.
    3. Navigate to the desired project (e.g., AirText) in the SunSPOT/sdk/Demos directory click Open Project.
    4. Attach a SPOT using the USB cable.
    5. Right-click the project and select "Build Project + Deploy to Sun SPOT".
    6. The Output window will show the status of the compilation/deployment. If it reaches 100% and shows "Build Successful", you should be set.
      1. You may notice that it asks you to reset the SPOT as it tries to deploy.
    7. Unplug the SPOT.
    8. RESET the SPOT. The SPOTs are very picky. When they don't look to be doing what you expect, the first thing to try is resetting. Click the small button on the bottom left.
    9. The SPOT should be running the Demo you just deployed!
    10. *Note* - if you are trying to run on the Linux machines in the lab, you will need to create a copy of the project between steps 3 and 4 above.

Run the following demos:

    • BounceDemo
    • AirText
    • RadioStrength
    • BuiltInSensorsDemo

Step 3 - Developing Your Own Programs

    1. Create a new Project called AirTemperature. Implement a program that displays the current temperature using "persistence of vision" as the AirText demo does.
      1. When you select New Project, you will want to select "Sun SPOT Application" as the type. "Sun SPOT Host Application" is used for the applications that will run on the basestation.
    2. Create a new Project called BinaryTemp. Implement a program that displays the current temperature in binary using the LEDs. A 1 is represented by an on LED and a 0 is represented by an off LED. A temperature of 70 degrees would be represented as follows: LED[0]: off - LED[1]: on - LED[2]: off - LED[3]: off - LED[4]: off - LED[5]: on - LED[6]: on - LED[7]: off

Submission

    1. For full credit, you must upload your code to your SVN repository. Upload your code into directories using the following naming convention. Failure to use this exact naming scheme may result in deduction of points.
      1. <username>/cs685/lab1/AirTemperature
      2. <username>/cs685/lab1/BinaryTemp
    2. See this SVN How-to for more information on using SVN.