27403 Parallax Inc, 27403 Datasheet - Page 125

GUIDE APP ROBOTCS W/SUMOBOT V1.0

27403

Manufacturer Part Number
27403
Description
GUIDE APP ROBOTCS W/SUMOBOT V1.0
Manufacturer
Parallax Inc
Datasheet

Specifications of 27403

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
Example Program: TestSideIrObjectDetectors.bs2
' -----[ Title ]--------------------------------------------------------------
' Applied Robotics with the SumoBot - TestSideIrObjectDetectors.bs2
' This program tests only IR object detectors on the SumoBot's breadboard
' that look to the left and right.
' front.
' {$STAMP BS2}
' {$PBASIC 2.5}
' -----[ I/O Definitions ]---------------------------------------------------
IrLedLS
IrSenseLS
IrLedRS
IrSenseRS
' -----[ Constants ]----------------------------------------------------------
IrFreq
' -----[ Variables ]----------------------------------------------------------
irLS
irRS
' -----[ Initialization ]-----------------------------------------------------
DEBUG CLS, "IR DETECTORS", CR,
' -----[ Main Routine ]-------------------------------------------------------
DO
LOOP
FREQOUT IrLedLS, 1, IrFreq
irLS = ~IrSenseLS
FREQOUT IrLedRS, 1, IrFreq
irRS = ~IrSenseRS
DEBUG CRSRX, 1, BIN1 irLS,
PAUSE 100
CRSRX, 9, BIN1 irRS
CON
VAR
VAR
"Left
"----
PIN
PIN
PIN
PIN
38500
Bit
Bit
Right", CR,
-----", CR
2
1
3
0
It does not test the ones mounted in
' Target = BASIC Stamp 2
' Language = PBASIC 2.5
' Left IR LED connected to P2
' Left IR detector to P1
' Right IR LED connected to P3
' Right IR detector to P0
' IR LED transmit frequency
' State of Left Side IR
' State of Right Side IR
' Display heading
' DO...LOOP repeats indefinitely
' Left IRLED shines IR light
' Save IR receiver output
' Repeat for Right IRLED/receiver
' Display object detect bits
' Delay for slower PCs

Related parts for 27403