27404 Parallax Inc, 27404 Datasheet - Page 177

COMPETITION RING FOR SUMOBOT

27404

Manufacturer Part Number
27404
Description
COMPETITION RING FOR SUMOBOT
Manufacturer
Parallax Inc
Datasheet

Specifications of 27404

Accessory Type
Hobby and Education
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
SumoBot®
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
Your Turn
Figure 4-10 shows a modified version of the state machine diagram that involves a
variable named
DO...LOOP
than or equal to 2 seconds (assuming the
delay before the LED starts blinking again, even if you keep pressing the button.
Hybrid State Diagrams for SumoBot Code Visual Aids
Here is the Main Routine from FrontIrNavigation.bs2 (See Activity #2 in this chapter). If
you rigidly adhered to the format from Figure 4-9 to make a state diagram for this code
block, it would be pretty complicated. Certainly complicated enough to make it useless
as a visual aid for designing more complex navigation routines.
DO
IF irLF = AND irRF = 1 THEN
ELSEIF irLF = 1 THEN
maneuver = Forward
GOSUB Servos_And_Sensors
counter = 0
DO UNTIL (irLF = AND irRF = 1) OR counter > 15
maneuver = PivotLeft
GOSUB Servos_And_Sensors
counter = counter + 1
Save PushbuttonLed.bs2 as PushbuttonLedYourTurn.bs2.
Modify the program so that it conforms to the state machine shown in Figure 4-
10. Hint: use loops like
code blocks.
Run and test the program, and trouble-shoot code as needed.
in PushubttonLed.bs2, the
counter
.
Because of the 100 ms pause between repeats of the
DO UNTIL counter ≥ 10
counter
counter
variable keeps the LED blink-time less
' Both?
' State = Lunge forward
' Just left?
' State = track front left object
' Pivot left 15
starts at 1). It also ensures a 1 second
Figure 4-10
Modified State
Diagram
inside the
IF
and
ELSE

Related parts for 27404