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

The Ectoplasmic Bouncing Ball Demo

 
 
Set-up

You need two free-range Sun SPOTs. The Sun SPOTs come with the Ectoplasmic Bouncing Ball demo already loaded, so just turn the free-range Sun SPOTs on.

The Effect

The graphic shows a free-range SPOT with the lid removed, radio fin pointing up.  The leftmost LED in the row of eight is red, as is the rightmost LED in the row.  Both have arrows pointing to them with the label 'Red Cork LEDs.'  There is one lit LED in the middle of the row.  It is glowing blue and is labeled 'Ectoplasmic Ball.'

In this demo, the row of LEDs on the top board of each Sun SPOT represents a tube. Note the red LEDs at either end of the LED row. Each represents a cork that keeps the ball in the tube.

Pick up a Sun SPOT and tilt it right and left to make the ball move. Thanks to the red corks, the ectoplasmic ball stays on the Sun SPOT.

Now we will connect the two free-range Sun SPOTs so that the balls can move from one SPOT to the other. Press one of the buttons on a Sun SPOT. The cork above the switch will start to blink.

This graphic shows the LED row again.  The same LEDs are lit as before, but the rightmost LED has a star over it to indicate that it is blinking.  An arrow points to it with the legend 'Cork LED blinks in search mode.'  There is also an arrow pointing to the rightmost switch with the legend 'Toggles cork search mode.'

The cork is searching for a partner cork on another SPOT. When two corks on different Sun SPOTs both enter search mode, they quickly find each other and the corks open up. Then the two ectoplasmic balls can be poured back and forth between the Sun SPOTs.

Press one of the buttons on another Sun SPOT. The two corks should find each other, open and connect the virtual tubes.

This graphic shows two Sun SPOTs next to each other, both with tops removed, both with radio fins pointing up.  Their LED rows are aligned to form, as much as possible, a single row.  The leftmost SPOT has its leftmost LED serving as a cork LED and glowing red.  The rightmost SPOT also has its rightmost LED glowing red and serving as a cork.  Neither the rightmost LED on the left SPOT and the leftmost LED on the right SPOT are lit at all.  A legend points to them and says 'The corks find each other, open and connect.' One of the middle LEDs on the leftmost SPOT glows blue.  One of the middle LEDs on the rightmost SPOT glows green.  A doubleheaded arrow under both rows of LEDs implies that the 'ball' LEDs can now move back and forth between both SPOTs.

You can pour ectoplasmic balls from one Sun SPOT to another.

Merge the Two Balls into One

The balls are a bit sticky. If two balls that come to rest in the same place, they stick to each other and merge into one ball. The color of the new ball will be the merged color of the original balls. For example, a red ball and a blue ball will merge to form a purple ball.

You can isolate any ball on a single Sun SPOT by reinstating the cork. Just press the button under the cork to break the connection and put the cork back in place. You can always open the ends again by putting two cork LEDs back into search mode. They will find each other and open a connection between the Sun SPOTs.

To restart the demo on a free-range SPOT, simply reset the SPOT (click the Control Button momentarily).

The Implementation

The Sun SPOTs use radio communication at the beginning of the demonstration to choose colors for each ectoplasmic ball. The SPOTs poll the 3-D accelerometer to determine their orientation. They use the orientation information to determine the movement of the ectoplasmic balls. Radio communication is used to determine if there is another Sun SPOT within range and if there is an open cork on that SPOT. If there is, a radio communication channel is established and used to pass the ball back and forth.

Next, we will take a look at another demonstration, the Air Text demo.


Next: Loading and Running the Air Text Demo

Back to top