Thursday, May 22, 2008

Servo Car [ Sun SPOT app ] (4)

Software setup

Let's write a first Sun SPOT application for Servo Car! Typically, Java IDE (like NetBeans) is very useful to write a large Sun SPOT application and I usually use it. However, to make things easy, let's begin with minimal developing environment -- Sun SPOT SDK, your favorite text editor & terminal.

Sun SPOT SDK has a color name according to its version. The current stable version (as of 5/23/2008) is v3 ("Purple" release), so let's use this version for the demo.

If you have a Sun SPOT Java Development Kit with Purple SDK CD-ROM, you may install it from CD. Otherwise, you can install SDK from http://www.sunspotworld.com/spotmanager/. This site keeps many different SDK versions other than Purple (v3) including beta versions, so I recommend the latter and will explain how to install SDK by using this site.

How to install Sun SPOT SDK
  1. access http://www.sunspotworld.com/spotmanager/ and click the Sun SPOT icon to launch Sun SPOT Manager tool
  2. Select "SDKs" tab
  3. Select purple-071018 (it may be labeled "Purple Beta RC5") from Available SDKs. If you don't see any versions in it, press "Refresh" button under Available SDKs.
  4. Press "Install" and "Sun SPOTs SDK Installer Tool" will be launched.
  5. Accept defaults other than "New SDK Directory Location". If you're a Windows user, it may begin with "C:\Program Files\Sun ..". There is no problem with this to develop Sun SPOT applications. But if you use Sun SPOT emulator, it causes some problems. So change this location ("C:\Program Files\Sun ..") to other place (e.g. "C:\Sun .."). For details, please refer to https://www.sunspotworld.com/forums/viewtopic.php?p=2809.
  6. Press "Install". After installing, press "Done".
  7. You should see the installed SDK on "Installed SDKs" panel.
If you change the "New SDK Directory Location" according to the above procedure, please edit .sunspot.properties and change "sunspot.home" value to meet your change.

To confirm your installation, connect a Sun SPOT to PC via USB cable , open your favorite terminal emulator and check the following command output.

$ cd $(SDK_DIRECTORY_LOCATION) <- specify your directory 
$
ant info
<..snip..>
-run-spotclient-once:
[java] SPOT Client starting...
[java] [waiting for reset]

[java] Local Monitor (purple-071018)
[java] SPOT serial number = 0014.4F01.0000.01A8

[java] Application slot contents:
[java] C:\cygwin\home\miyake\tmp\ServoTest
[java] 2350 bytes
[java] last modified Fri May 23 11:58:24 JST 2008

[java] Startup:
[java] Squawk startup command line:
[java] -flashsuite:10900000
[java] -Xboot:268763136
[java] -Xmx:478000
[java] -Xmxnvm:128
[java] -isolateinit:com.sun.spot.peripheral.Spot
[java] -dma:1024
[java] -MIDlet-1
[java] OTA Command Server is enabled
[java] Configured to run the current application

[java] Library suite:
[java] hash=0xa2fb25
[java] Installed library matches current SDK library
[java] Installed library matches shipped SDK library
[java] Current SDK library matches shipped SDK library

[java] Security:
[java] Owner key on device matches key on host

[java] Configuration properties:
[java] spot.external.0.firmware.version: 1.9
[java] spot.external.0.hardware.rev: 5.0
[java] spot.external.0.part.id: EDEMOBOARD_REV_0_2_0_0
[java] spot.hardware.rev: 5
[java] spot.mesh.management.enable: true
[java] spot.mesh.traceroute.enable: false
[java] spot.ota.enable: true
[java] spot.powercontroller.firmware.version: PCTRL-1.79
[java] spot.sdk.version: purple-071018

[java] Exiting

-run-spotclient-multiple-times-locally:

-run-spotclient:

BUILD SUCCESSFUL
Total time: 2 seconds


"ant info" checks the connected Sun SPOT information. If you see the same output as the above one, congratulations! Your installation was successful.

No comments: