Shop OBEX P1 Docs P2 Docs Learn Events
Input while controlling servos, is it possible? — Parallax Forums

Input while controlling servos, is it possible?

KamenKamen Posts: 4
edited 2006-07-13 15:41 in BASIC Stamp
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?

Comments

  • Paul Sr.Paul Sr. Posts: 435
    edited 2006-07-13 13:07
    Kamen said...
    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?

    Sounds like you might want to consider using the Parallax Servo Controller www.parallax.com/detail.asp?product_id=28023
  • KamenKamen Posts: 4
    edited 2006-07-13 13:49
    For that price I'd be picking up this instead
    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?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-13 14:11
    Kamen,

    ·· 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
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-07-13 15:41
    Yup, using SERIN 16 with a timeout. This will require retransmission of "missed messages" from Hyperterminal, though.
Sign In or Register to comment.