Programming trouble
Farmall JD
Posts: 5
Hi everyone. I am a green horn to all this so be gentle. I am working on the BOE kit and activity #5 the reaction timer. I wrote the program just like it is in the book but I am coming up with error 141. Here is what it all looks like. The error is happening at the 1st "DO" and then if I delete it hits the next one. Anyone have an idea for me?? Thank you for all your help.
' {$STAMP BS2}
' {$PBASIC 2.5}
' Test reaction time with a push button and bi-coloured led
timeCounter VAR Word ' Declare variable to store time
DEBUG "Press and hold the pushbutton." , CR,
"to make the light turn RED." , CR,
"When the light turns Green, let", CR,
" go as fast as you can.", CR, CR,
DO 'Begin the main loop
DO ' Nested loop repeats until
' the BUTTON is pressed
LOOP UNTIL IN3 = 1
LOW 14 ' Bi-colour LED Red
HIGH 15
PAUSE 1000 ' 1 sec delay
HIGH 14 'LED turns Green
LOW 15
timeCounter = 0 ' Set timeCounter to zero
DO ' Nested loop, count time
PAUSE 1
timeCounter = timeCounter + 1
LOOP UNTIL IN3 = 0 ' Until pushbutton is released
LOW 14 ' LED off
DEBUG "Your time was", DEC timeCounter, ' Display time
"ms.", CR, CR,
"To play again, hold the", CR 'play again instructions
"button down again." CR,CR
LOOP ' back to "Begin main loop"
' {$STAMP BS2}
' {$PBASIC 2.5}
' Test reaction time with a push button and bi-coloured led
timeCounter VAR Word ' Declare variable to store time
DEBUG "Press and hold the pushbutton." , CR,
"to make the light turn RED." , CR,
"When the light turns Green, let", CR,
" go as fast as you can.", CR, CR,
DO 'Begin the main loop
DO ' Nested loop repeats until
' the BUTTON is pressed
LOOP UNTIL IN3 = 1
LOW 14 ' Bi-colour LED Red
HIGH 15
PAUSE 1000 ' 1 sec delay
HIGH 14 'LED turns Green
LOW 15
timeCounter = 0 ' Set timeCounter to zero
DO ' Nested loop, count time
PAUSE 1
timeCounter = timeCounter + 1
LOOP UNTIL IN3 = 0 ' Until pushbutton is released
LOW 14 ' LED off
DEBUG "Your time was", DEC timeCounter, ' Display time
"ms.", CR, CR,
"To play again, hold the", CR 'play again instructions
"button down again." CR,CR
LOOP ' back to "Begin main loop"
Comments
The zip file contains a PDF file called Usng The PBasic Tokenizer Library, starting at page 20 is a list of error messages.
Jeff T.