Problems with the IR Obect Indicators TestBothIrAndIndicators
eMarston15
Posts: 3
Hey, everyone. I was hoping I could get some help with the script from chapter 7 activity #2, TestBothIrAndIndicators.bs2.
When I run the script (below) it highlights DO (under [ Main routine ] and comes up with an error saying "Expected a constant, variable, unary operator, or '('.
If someone could take a look at the script and let me know if there's something wrong with it, or if I should just take a look at the wiring again to see if I missed anythingwhich isn't likely, because I have checked about three times now, and taken everything off and put it back on one piece at a timethat would be greatly appreciated. Thanks!
' Robotics with the Boe-Bot - TestBothIrAndIndicators.bs2
' Test IR object detection circuits.
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[ Variables ]
irDetectLeft VAR Bit
irDetectRight VAR Bit
'
[ Initialization ]
DEBUG "Testing piezpspeaker..."
FREQOUT 4, 2000, 3000
DEBUG CLS,
"IR DETECTORS", CR,
"Left Right", CR,
"
",
'
[ Main Routine ]
DO
FREQOUT 8, 1, 38500
irDetectLeft = IN9
FREQOUT 2, 1, 38500
irDetectRight
IF (irDetectLeft = 0) THEN
HIGH 10
ELSE
LOW 10
ENDIF
IF (irDetectRight = 0)THEN
HIGH 1
ELSE
LOW 1
ENDIF
DEBUG CRSRXY 2, 3, BIN1 irDetectLeft,
DEBUG CRSRXY 9, 3, BIN1 irDetetRight
PAUSE 100
LOOP
Any suggestions you guys have would be appreciated, if nothing comes up then I'll probably end up calling tech support. Thanks, guys!
When I run the script (below) it highlights DO (under [ Main routine ] and comes up with an error saying "Expected a constant, variable, unary operator, or '('.
If someone could take a look at the script and let me know if there's something wrong with it, or if I should just take a look at the wiring again to see if I missed anythingwhich isn't likely, because I have checked about three times now, and taken everything off and put it back on one piece at a timethat would be greatly appreciated. Thanks!
' Robotics with the Boe-Bot - TestBothIrAndIndicators.bs2
' Test IR object detection circuits.
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[ Variables ]
irDetectLeft VAR Bit
irDetectRight VAR Bit
'
[ Initialization ]
DEBUG "Testing piezpspeaker..."
FREQOUT 4, 2000, 3000
DEBUG CLS,
"IR DETECTORS", CR,
"Left Right", CR,
"
",
'
[ Main Routine ]
DO
FREQOUT 8, 1, 38500
irDetectLeft = IN9
FREQOUT 2, 1, 38500
irDetectRight
IF (irDetectLeft = 0) THEN
HIGH 10
ELSE
LOW 10
ENDIF
IF (irDetectRight = 0)THEN
HIGH 1
ELSE
LOW 1
ENDIF
DEBUG CRSRXY 2, 3, BIN1 irDetectLeft,
DEBUG CRSRXY 9, 3, BIN1 irDetetRight
PAUSE 100
LOOP
Any suggestions you guys have would be appreciated, if nothing comes up then I'll probably end up calling tech support. Thanks, guys!
Comments
Hello eMarston15 - welcome to the Forum.
It would appear that irDetectRight is "orphaned", with no value assignment.
Line 29--missing = IN0
Line 43-- missing comma after CRSRXY
Line 44--DEBUG statement does not belong because of the comma on the preceding line.
Line 44--irDetectRight spelled wrong.