Input while controlling servos, is it possible?
Kamen
Posts: 4
My application is using the BS2 as a servo controller that will adjust servo positions (and a robot arm) based on realtime input from the PC (Hyperterminal). The part I'm stuck on is actually getting that input from the PC, since every example Ive seen of DEBUGIN halts the program until all of the input is entered. When this happens, the servos lose position under the weight of the arm as they "relax" when not receiving control pulses.
My problem now becomes, how to take an input string while going through a loop maintaining those control pulses? I'm thinking check for a new keypress every time through the loop, add it to an array, and process the array as a command once it sees 13 (enter).
Can this actually be done on the BS2? Or is there a simpler non-blocking method for getting input that I'm overlooking?
My problem now becomes, how to take an input string while going through a loop maintaining those control pulses? I'm thinking check for a new keypress every time through the loop, add it to an array, and process the array as a command once it sees 13 (enter).
Can this actually be done on the BS2? Or is there a simpler non-blocking method for getting input that I'm overlooking?
Comments
Sounds like you might want to consider using the Parallax Servo Controller www.parallax.com/detail.asp?product_id=28023
http://www.lynxmotion.com/Product.aspx?productID=395&CategoryID=52
But I'm already overbudget on this project, with the oh so worth it servo erector set parts also from Lynxmotion.
Besides, its a programming challenge to get it done with just the BS2. If I cave in and just buy a dedicated controller, wheres the victory?
·· You can do this, but it depends on the amount of data and the frequency of it coming into the BASIC Stamp Serial Port.· What you need to do is put your SERIN within the loop and adjust your delay timing so that you instead timeout the SERIN statement at 20ms intervals.· You will need to find a balance based on frequency of data, but it could work.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com