Because this is a bigger programming challenge than
we’ve ever seen, I couldn’t fit it all in one article! This will
be the first of a two-part series. Be sure and pick up next
month’s edition of SERVO Magazine for the conclusion.
This article will assume that you:
• Have already built Eddie 2.0, or a similar driving base that
uses tank steering. Eddie 2.0 building instructions can be
found in the January ‘ 11 issue.
Introducing the Challenge
This will be our coolest and most difficult challenge
yet! The idea is that we want to detect angular rotation
from the Hi Technics gyro sensors, send that data over
Bluetooth to the other NXT, and then use it to control
Eddie 2.0 (or your own driving robot).
If that wasn’t complicated enough, we’re also going
to have to use our own programming hack to turn the
sensor readings into something we can use, but more on
Exploring the Gyro Sensors
Let’s get started by understanding the sensors we’ll be
using. Hi Technics gyro sensors measure angular movement
in degrees per second. This means that if the sensor is not
moving, it will read 0. If the sensor is spinning at 1 RPM
(rotation per minute), that means that it’s spinning 360
degrees every 60 seconds; 360/60 = 6 so if the gyro sensor
is moving 1 RPM, it will read six degrees per second.
Gyro Test Program 1 Instructions
Figure 2. From the advanced palette, add a number-to-text
block. Then add a display block from the common palette. Set
the display action to Text. Finally, wire the Raw Value output of
the gyro sensor to the input of the number-to-text block, and
wire the output of the number-to-text block to the text input of
the display block.
Figure 1. Create a new program called Gyro_Test_1. Add a
loop, and inside the loop, add a gyro sensor block.
Figure 3. Add a Wait For block and set it to . 2 seconds (that's
1/5th of a second — not two seconds!).
SERVO 07.2011 71