attachment for Eddie.
Okay, now that the sound sensor attachment is built
and attached, let’s get to the program (see below)!
Go ahead and test it out. If you make a loud noise,
Eddie should move quickly away; if you make less noise,
he’ll slow down.
A Noise Controlled Robot?
So, what else can we do with that sound sensor? Well,
if we change up our program just a tad, we can get Eddie
to determine his direction based on the volume of the noise
he hears. Let’s give it a go!
The sound sensor will give a value between 0 and 100.
A value of 0 means silence and a value of 100 means loud
noises! Recall that we have a data port on the motor to
control steering dynamically. This port interprets a value of
-100 as a hard left turn; 0 as straight forward; and 100 as a
hard right turn.
If we wanted Eddie to be very precise in how he reacts
to sounds, we’d add a step and make a sound value of 0
equal a steering value of -100 and a sound value of 100
equal a steering value of 100. That said, our goal here is to
make Eddie easy to control by sound, so we’ll make his
turns more gradual by making the harshest steering values -
50 and 50 instead of -100 and 100.
Give it a go. If you’re really quiet, Eddie should turn
left. If you’re really loud, Eddie will turn right, and if you’re
just right, he’ll go straight!
A Bigger Challenge
Okay. Now that we’ve done some experimenting, let’s
make something awesome! We’ll use the sound sensor to
Sound Speed Program
• Create a program called Sound_Speed.
• Drag in a loop, inside of which your program will take place.
• Add a sound sensor block and make sure it's set to port 2.
• Add a motor block and set motors B and C to forward.
• Run a data wire from the output of the sound sensor block to
the power data port of the motor block.
Sound Steering Program
• Bring up your Sound_Speed program, and save it as
• Add a math block and wire the output of the sound sensor
block to A. For B, choose 50; for operation, choose
• Wire the output of the math block to the steering data port
of the motor block.
64 SERVO 09.2011