Hardware or Code?
Legotto
Posts: 2
in BASIC Stamp
I am loading this code onto a boe bot, and it seems to take it, but when it pauses, instead of turning left or right, or going backwards, it just goes forward. Am I missing something with this code? I'm attempting to help a high school student with their homework, and I am at a loss.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
counter VAR Word
FREQOUT 4, 2000, 3000 ' Signal program start/reset.
FOR counter = 1 TO 64 ' Forward
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR counter = 1 TO 24 ' Rotate left - about 1/4 turn
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR counter = 1 TO 24 ' Rotate right - about 1/4 turn
PULSOUT 13, 850
PULSOUT 12, 850
PAUSE 20
NEXT
PAUSE 200
FOR counter = 1 TO 64 ' Backward
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
END
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
counter VAR Word
FREQOUT 4, 2000, 3000 ' Signal program start/reset.
FOR counter = 1 TO 64 ' Forward
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR counter = 1 TO 24 ' Rotate left - about 1/4 turn
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR counter = 1 TO 24 ' Rotate right - about 1/4 turn
PULSOUT 13, 850
PULSOUT 12, 850
PAUSE 20
NEXT
PAUSE 200
FOR counter = 1 TO 64 ' Backward
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
END
Comments
As Banjo pointed out, batteries are usually the culprit when it does something it's not supposed to.
Do you hear a beeping noise coming from the Piezo Speaker?
The bot can do all of these commands independently, but when you combine them into one file, and load it onto the bot, it only goes forward.
FOR counter = 1 TO 64 ' Backward
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
Print "Entered BACKWARD Cntr ="; counter
NEXT