View Full Version : Linux problem with ServoControlWithDebug.bs2

08-04-2008, 04:57 AM
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.


' What's a Microcontroller first program
' BASIC Stamp sends message to the debug terminal

'{$PBASIC 2.5}

counter VAR Word
pulses VAR Word
duration VAR Word

DEBUG CLS, "Enter number of pulses:", CR

DEBUG "Enter pulsout duration:", CR
DEBUGIN DEC duration

DEBUG "Servo is running....", CR

FOR counter = 1 to pulses
PULSOUT 14, duration

PAUSE 1000


Mike Green
08-04-2008, 05:19 AM
What are you using for the debug terminal? You didn't say whether the first DEBUG message showed up. The Stamp is expecting some input characters from its programming serial port, the same one that's displaying the DEBUG messages.

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.

08-04-2008, 05:26 AM
Whups, guess that would help, huh? :) I'm using the software from http://bstamp.sourceforge.net/ Sorry, yes, the first DEBUG message comes up, I enter my value for pulses, hit enter and then it just sits on the next line and nothing happens. I've hit enter a few times and it still does nothing. I've let it go at least a few minutes. I've re'tokenized' and rerun the code, but it still does the same thing.

08-05-2008, 05:28 AM
I re-read what you wrote about DEBUGIN tonight and it got me thinking so I did some searching and found a thread with the same problem:


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. :)