Linux problem with ServoControlWithDebug.bs2
angrek
Posts: 5
Everything has been going fine until I hit this part of the book. It just seems to hang after the first input for pulses, I hit enter and it just sits there. I'm pretty sure the code is correct, I just don't see why it would be hanging. Am I missing something? Any help would be appreciated, thanks.
Code:
' What's a Microcontroller first program
' BASIC Stamp sends message to the debug terminal
'{$STAMP BS2}
'{$PBASIC 2.5}
counter VAR Word
pulses VAR Word
duration VAR Word
DO
DEBUG CLS, "Enter number of pulses:", CR
DEBUGIN DEC pulses
DEBUG "Enter pulsout duration:", CR
DEBUGIN DEC duration
DEBUG "Servo is running....", CR
FOR counter = 1 to pulses
PULSOUT 14, duration
PAUSE 20
NEXT
DEBUG "DONE"
PAUSE 1000
LOOP
Code:
' What's a Microcontroller first program
' BASIC Stamp sends message to the debug terminal
'{$STAMP BS2}
'{$PBASIC 2.5}
counter VAR Word
pulses VAR Word
duration VAR Word
DO
DEBUG CLS, "Enter number of pulses:", CR
DEBUGIN DEC pulses
DEBUG "Enter pulsout duration:", CR
DEBUGIN DEC duration
DEBUG "Servo is running....", CR
FOR counter = 1 to pulses
PULSOUT 14, duration
PAUSE 20
NEXT
DEBUG "DONE"
PAUSE 1000
LOOP
Comments
When you have a DEBUGIN statement with a DEC formatter, you will have to put in some kind of numeric value, The Stamp expects a digit string terminated by some kind of non-digit character and will ignore other input until a digit comes.
http://forums.parallax.com/forums/default.aspx?f=5&m=136628
If I go to another terminal and type 'echo 100 > /dev/bstamp' and go back to my first terminal, it's accepted it and gone to the second prompt.
I'm guessing from here that this is a code problem with the linux bstamp app that I'm using. Previous thread is from 2005 so I'm guessing not a lot of work has been done on the code (or he didn't see/know about the bug). I guess I'll just work around it in a second terminal for the time being and if I get some spare time maybe I'll take a look at the code and see if I can figure out what's wrong with it. Thanks for pointing me in the correct direction. [noparse]:)[/noparse]