Datasheet
Page 160ยท Applied Robotics with the SumoBot
' -----[ Title ]--------------------------------------------------------------
' Applied Robotics with the SumoBot - FrontIrNavigation.bs2
' When it sees an object with only one object detecting eye, it corrects
' it's heading until it sees the object with both eyes.
' {$STAMP BS2} ' Target = BASIC Stamp 2
' {$PBASIC 2.5} ' Language = PBASIC 2.5
' -----[ I/O Definitions ]---------------------------------------------------
ServoLeft PIN 13 ' Left servo connected to P13
ServoRight PIN 12 ' Right servo connected to P12
IrLedLS PIN 2 ' Left IR LED connected to P2
IrSenseLS PIN 1 ' Left IR detector to P1
IrLedLF PIN 4 ' Left IR LED connected to P4
IrSenseLF PIN 11 ' Left IR detector to P11
IrLedRF PIN 15 ' Right IR LED connected to P15
IrSenseRF PIN 14 ' Right IR detector to P14
IrLedRS PIN 3 ' Right IR LED connected to P3
IrSenseRS PIN 0 ' Right IR detector to P0
' -----[ Constants ]----------------------------------------------------------
' SumoBot maneuvers
Forward CON 0 ' Forward
Backward CON 1 ' Backward
RotateLeft CON 2 ' RotateLeft
RotateRight CON 3 ' RotateRight
PivotLeft CON 4 ' Pivot to the left
PivotRight CON 5 ' Pivot to the right
CurveLeft CON 6 ' Curve to the left
CurveRight CON 7 ' Curve to the right
' Servo pulse width rotations
FS_CCW CON 850 ' Full speed counterclockwise
FS_CW CON 650 ' Full speed clockwise
NO_ROT CON 750 ' No rotation
LS_CCW CON 770 ' Low speed counterclockwise
LS_CW CON 730 ' Low speed clockwise
' IR object detectors
IrFreq CON 38500 ' IR LED frequency
' -----[ Variables ]----------------------------------------------------------