Sun SPOT Quick Start Tutorial: Ectoplasmic Bouncing Ball Demo (https://www.sunspotworld.com/docs/Green/Tutorial/EctoplasmicBall

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

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. At first, the ball on any Sun SPOT will be blue. However, if the Sun SPOTs are able to communicate with each other, they will allocate different colors for the ectoplasmic balls to avoid, as much as possible, duplication.

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.

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.

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值