Terrapin Resources

Sensors

Turning Sensors On and Off

Pro-Bot sensors can be turned off and on but must be turned on for Pro-Bot to respond to them. Turning sensors off when they are not in use conserves battery power. Sensors are turned off by default but maintain their state once they are set.

Toggling the Sensors

To turn the sensors on or off, press Menu. From the Toplevel menu, use the down arrow key to choose Sensors and press Menu to see the Sensor menu, which shows each sensor state. The default Sensor menu is

Each of the three types of sensors can be toggled between On and Off. Use the down arrow key to select the sensor whose state you would like to change. Press Menu to change the sensor’s state. Pro-Bot toggles the sensor from Off to On or from On to Off and returns you to the Main program.

Confirming Sensor State

To confirm that the sensor state has changed, press Menu, choose Sensors and note that the state of the sensor you selected has been toggled. Select Back to return to the Toplevel menu and select Back from there to return to the Main program.

Try it: For example, if TouchOff displays in the Sensor menu, Pro-Bot does not recognize either of its bumpers being triggered and will not run subprocedure 33 FRONT or subprocedure 34 REAR when the bumper is pressed. To activate the bumpers so that subprocedure 33 FRONT or 34 REAR is run when the corresponding bumper is pressed, press Menu from the Main program. Use the down arrow key to choose Sensors. In the Sensor menu, use the down arrow key to highlight TouchOff and press Menu. The bumpers are activated and you return to the Main program

To verify that the Touch sensors are active, press Menu, choose Sensors, and press Menu. Touch On displays and the touch sensors are activated. Select Back and press Menu to return to the Toplevel menu where Back is highlighted. Press Menu again to return to the Main program.

Touch Sensors

Pro-Bot contains touch sensors that are activated when the front or rear bumper is pressed. When the touch sensors are turned on and one of the bumpers is pressed, Pro-Bot interrupts the Main program to run the commands in the subprocedure corresponding to the front or rear bumper.

Try it: Make Pro-Bot back up and turn when it encounters an object that presses the front bumper while it is moving forward. You need to send Pro-Bot forward in the Main program and then define back up and turn by entering commands in subprocedure 33 FRONT.

Setting Up

First, be sure that the touch sensors are turned on. Then enter the commands you would like Pro-Bot to follow when the front bumper is triggered. Press Menu, choose New Proc, press Menu, choose subprocedure 33 FRONT, and press Menu. 33 FRONT displays on the screen and you are ready to enter commands.

Entering Commands

For Pro-Bot to go back 20 steps and turn right 90 degrees when it encounters an obstacle that presses the front bumper, press the back arrow and 2 0 followed by the right arrow and 9 0.

Starting a Main Program

Press Menu to return to the Main program. Use the Main program to tell Pro-Bot to move forward. For example, you can send Pro-Bot forward 100 steps by pressing the forward arrow followed by 1 0 0. Press GO to start the Main program.

Responding to a Bumper Press

Pro-Bot moves forward until it has completed 100 steps or encounters an object that presses the front bumper. When the front bumper is pressed, Pro-Bot suspends the Main program and follows the commands in subprocedure 33 FRONT. The screen switches from displaying the commands in the Main program to display the commands in subprocedure 33 FRONT. You can see each command is highlighted as it is executed. When Pro-Bot finishes all the commands in subprocedure 33 FRONT, it returns to the Main program and begins executing the Main program from the beginning.

Programming the Back Bumper

Pro-Bot may be programmed to respond to the back bumper being pressed in a manner similar to that for the front bumper. Simply enter the commands you want Pro-Bot to follow when the back bumper is pressed in subprocedure 34 REAR rather than 33 FRONT.

When Pro-Bot’s bumper touch sensors are turned on, Pro-Bot responds to either the front or back bumper being pressed. The same or different commands may be entered in subprocedures 33 FRONT and 34 REAR to define what Pro-Bot does in either case.

Sound Sensor

Pro-Bot contains a sound sensor that detects short sharp sounds such as a hand clap, a short yell, or other loud sound. Pro-Bot only listens for sounds when the motors are not running so that the sound of the motors does not trigger the sound sensor. Pro-Bot may be programmed to respond to sounds when a Main program is running but the motors are not activated. This may be achieved by inserting pauses in a Main program.

Activating the Sound Sensor

Pro-Bot’s sound sensor must be activated for Pro-Bot to respond to sounds it detects. To activate the sound sensor, press Menu, use the arrow key to select Sensors, and press Menu to display the Sensors menu. If SoundOff appears in the Sensors menu, then use the arrow key to select it and press Menu. The sound sensor is turned on and the Main program appears. If Sound On appears in the Sensors menu display, then simply press Menu twice to return to the Main program screen.

Try it: Decide what you would like Pro-Bot to do when it detects a loud sharp sound. Enter the commands you would like Pro-Bot to follow in subprocedure 37 SOUND.

To turn Pro-Bot 90 degrees when you clap your hands loudly, add that command to subprocedure 37 SOUND. Press Menu and select New Proc. (If you choose Edt Proc, the current contents of subprocedure 37 SOUND appear which you can change. If you choose New Proc, the current contents of subprocedure 37 SOUND are erased and 37 SOUND appears blank. You can then add commands.) Use the arrow keys to select subprocedure 37 SOUND and press Menu.

Enter commands to turn Pro-Bot 90 degrees by pressing the right arrow and then 9 0. When you are finished, press Menu to return to the Main program. Enter commands in the Main program to move Pro-Bot about. Be sure to enter pauses after the movement commands so Pro-Bot can listen for a sound.

For example, you can tell Pro-Bot to move forward 20 steps and then back 20 steps four times, pausing after each move. To do so enter

Press GO so Pro-Bot executes the program. During a pause, clap your hands loudly. On hearing the sound, Pro-Bot executes subprocedure 37 SOUND and turns right 90 degrees. After completing subprocedure 37 SOUND, Pro-Bot returns to complete the Main program at the point at which the sound occurred.

Light Sensor

Pro-Bot contains a light sensor located in the middle of the hood that can sense when the ambient light changes. This allows Pro-Bot to be programmed to respond when going through a dark tunnel or when the lights in the room are turned off and then on again.

Activate the Light Sensor

Pro-Bot’s light sensor must be activated for it to respond to changes between light and dark. To activate the light sensor, press Menu, use the arrow keys to select Sensors, and press Menu to display the Sensors menu. If LightOff appears in the Sensors menu, use the arrow key to select it and press Menu. The light sensor is turned on and the Main program appears. If Light On appears in the Sensors menu, then simply press Menu twice to return to the Main program.

Light and Dark Subprocedures

Two subprocedures are reserved for defining how Pro-Bot responds to changes between light and darkness. Subprocedure 35 DARK holds commands that Pro-Bot executes when its environment becomes dark. Subprocedure 36 LIGHT holds commands that Pro-Bot executes when its environment changes from dark to light.

Try it: If you would like Pro-Bot to pause the Main program when the lights go out, you can enter one or more pauses in subprocedure 35 DARK. To do so, press Menu and use the arrow keys to select New Proc. Then use the arrow keys to select 35 DARK. Enter one or more pauses in the subprocedure by pressing Pause one or more times. Then press Menu to return to the Main program. If you have not yet entered a Main program, do so now.

Press GO to begin execution of the Main program. Turn the lights out. Pro-Bot pauses by following the commands in 35 DARK. Pro-Bot returns to the Main program when the lights are turned on or all the pauses in 35 DARK have been completed, whichever comes first.

If all you want is for Pro-Bot to return to the Main program when it emerges from darkness, there is no need to enter commands in subprocedure 36 LIGHT. If you want Pro-Bot to do something after it emerges from the dark and before it returns to the Main program, you can enter those commands in 36 LIGHT. They are executed after Pro-Bot emerges from darkness before returning control to the Main program.