122-27400 Parallax Inc, 122-27400 Datasheet - Page 51

MANUAL FOR SUMOBOT

122-27400

Manufacturer Part Number
122-27400
Description
MANUAL FOR SUMOBOT
Manufacturer
Parallax Inc
Datasheet

Specifications of 122-27400

Accessory Type
Manual
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
SUMOBOT MOTION CONTROL
The next task is to link the SumoBot robot’s ability to "see" with the motors so that an
object – the opponent – can be tracked.
demonstration of linking IR object control to the SumoBot motors.
' SumoBot_4.2_IR_Scan.BS2
' {$STAMP BS2}
' {$PBASIC 2.5}
' -----[ I/O Definitions ]-------------------------------------------------
LMotor
RMotor
LfIrOut
LfIrIn
RtIrOut
RtIrIn
' -----[ Constants ]-------------------------------------------------------
LFwdFast
LFwdSlow
LStop
LRevSlow
LRevFast
RFwdFast
RFwdSlow
RStop
RRevSlow
RRevFast
' -----[ Variables ]-------------------------------------------------------
irBits
irLeft
irRight
lastIr
pulses
' -----[ Initialization ]--------------------------------------------------
Reset:
' -----[ Program Code ]----------------------------------------------------
LOW LMotor
LOW RMotor
PIN
PIN
PIN
PIN
PIN
PIN
CON
CON
CON
CON
CON
CON
CON
CON
CON
CON
VAR
VAR
VAR
VAR
VAR
13
12
4
11
15
14
1000
1000
Nib
irBits.BIT1
irBits.BIT0
Nib
Byte
800
750
700
500
500
700
750
800
Load and run program 4.2 to see a
Chapter 4: Infrared Object Detection · Page 41
' left servo motor
' right servo motor
' left IR LED output
' left IR sensor input
' right IR LED output
' right IR sensor input
' left motor fwd; fast
' left motor fwd; slow
' left motor stop
' left motor rev; slow
' left motor rev; fast
' right motor fwd; fast
' right motor fwd; slow
' right motor stop
' right motor rev; slow
' right motor rev; fast
' storage for IR target data
' info from last reading
' counter for motor control
' initialize motor outputs

Related parts for 122-27400