Looking for a little help.
Fusion360
Posts: 5
Hello, new to this whole BASIC thang...
I am sure that somewhere in the great information superhighway this exhixts:
I am looking for a code that accomplishes this:
I am looking to control a servo (I have a Basic Stamp Home Work Board and servo assembled as specified) I would like to assign the keys on my keyboard to have a value (percentage) of servo movement (i.e., pressing the "G" key would move the servo let's say 7% and "H" would move it 8% etc., etc.) I am sure that a someone had created a BASIC code that acheives this I just am ignorant as to where to look.
Any help in finding (or writing) this would be most helpful!
Thanks in advance!
Scott
·I just like this little guy!
I am sure that somewhere in the great information superhighway this exhixts:
I am looking for a code that accomplishes this:
I am looking to control a servo (I have a Basic Stamp Home Work Board and servo assembled as specified) I would like to assign the keys on my keyboard to have a value (percentage) of servo movement (i.e., pressing the "G" key would move the servo let's say 7% and "H" would move it 8% etc., etc.) I am sure that a someone had created a BASIC code that acheives this I just am ignorant as to where to look.
Any help in finding (or writing) this would be most helpful!
Thanks in advance!
Scott
·I just like this little guy!
Comments
·· Are you trying to do this from a keyboard, or from the PC itself?· If from the PC you would need some software on the PC side as well to handle key presses and send them to the BASIC Stamp, unless you used the DEBUG window.· In any event it's basically a matter of inputting the keystrokes via SERIN and having a small lookup for the key value that correlates to a PULSOUT value.· You could also achieve your servo delay using the timeout on the SERIN.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Thanks again, I really appreciate it!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
I appreciate the help, thanks agian!
a servo needs a pulse every 20 ms. That pulse needs to be between 1 and 2 ms in width. 1 ms pulse is full counter clockwise and 2 ms pulse is full clockwise. Look at the timing for PULSOUT for the stamp that you have. IT is IMPORTANT that you realize the timing varies from one stamp to the next. Use DEBUGIN to read your letters from the keyboard, when the letter = X ( insert your letter here) Pulsout to the servo the appropriate pulse width in microseconds to the servo. Use the help function in the PBasic editor to study FOR... NEXT, PULSOUT, DEBUG and DEBUGIN . This should help you get started. You can do this.
Servos do in fact need to be refreshed if they have not yet arrived at the desired position, and to maintain position (actively) if the position has already been reached.
There are newer servos that have different timing/resolution needs, be aware of that.
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Clarke
Parallax Tech Support
rclarke@parallax.com
Post Edited (RoboROOKIE) : 9/7/2005 11:29:52 PM GMT
Thank you so much for your help! I'll go check it out right now!