Shop OBEX P1 Docs P2 Docs Learn Events
Controlling Robot Via COM1 (com prot 1) — Parallax Forums

Controlling Robot Via COM1 (com prot 1)

HavoKaneHavoKane Posts: 109
edited 2005-05-02 11:36 in Robotics
is there any way to do this? to directly control mt boe-bot from the port using commands of some sort? is there a program that can do this, or what?

Post Edited (HavoKane) : 10/14/2004 8:10:15 PM GMT

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-10-14 21:36
    Sure you could do it, but I'm not sure anyone has written that program. In short, you could have your BASIC Stamp wait on a command, then process it. But ... you also have to deal with servos. So what you do is set the SERIN timeout to 20 ms and have the Timeout jump to the servo update routine.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • allanlane5allanlane5 Posts: 3,815
    edited 2004-10-15 13:26
    Brilliant Jon! Use the SERIN timeout to time the updates of the PULSOUT command (Servo Control). Neat.

    What language did you want to use on the PC to talk to the BS2? C++? VB?
  • HavoKaneHavoKane Posts: 109
    edited 2004-10-30 15:50
    either VB or PBasic
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-10-30 16:13
    PBASIC is only available on the BASIC Stamp -- there is no PC version of PBASIC. You can use VB, or if RealBASIC (www.realbasic.com) which is only $100 and comes with serial control capabilities.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • HavoKaneHavoKane Posts: 109
    edited 2004-10-30 18:37
    so would i have to make a program in VB that would call the commands in PBasic that would route them to the serial port?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-10-30 20:30
    You would create a program in VB that runs on your PC that "talks" to the BASIC Stamp -- which is running its own (PBASIC) program to accept and interpret the commands. Our RS-232 AppMod docs show how and includes a VB application demo.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • HavoKaneHavoKane Posts: 109
    edited 2004-10-30 20:32
    cool, thanks
  • Russ FergusonRuss Ferguson Posts: 206
    edited 2004-11-01 21:18
    My son and I have a program that allows us to directly control the Boe-Bot from the debug screen.
    The Boe-Bot does not have any connection on it other than the servos and the serial cable.

    The Boe-Bot·interprets the numbers from the numeric·keypad to be forward/reverse/pivot left/pivot right/forward&right, etc...· It does not understand the arrow keys between the alpha keys and the numeric keypad.

    Perhaps this is close to what you were looking for.
  • HavoKaneHavoKane Posts: 109
    edited 2005-04-16 15:37
    it is, but i cant get it to work. when i load the code into the bot, put it into EXEC (switch position 2) it doesnt do anything. do i need to do something else?
  • Zhao WangZhao Wang Posts: 4
    edited 2005-04-26 02:38
    You do realize that you can just do debugin on a number sent in a debug window, do lookup or branch with it, and move the servos? Very simple.
  • HavoKaneHavoKane Posts: 109
    edited 2005-04-28 19:39
    i dont understand. can you explain that in a little more detail?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-29 13:02
    I'm writing this off the top of my head, and before I've had my morning Starbucks fix ... but I think this will work for you (I've used this type of code several times):

    Get_Command:
    · DEBUGIN cmd
    · LOOKDOWN cmd, [noparse][[/noparse]"fFbBlLrR], cmd
    · IF (cmd > 7) THEN Get_Command
    · cmd = cmd / 2
    · ON cmd GOSUB Go_Fwd, Go_Back, Go_Left, Go_Right
    · GOTO Get_Command

    Here's how it works: DEBUGIN gets a character from the Debug Terminal window.· The character is compared to a valid list using LOOKDOWN, and if it's in that list cmd will be converted to the position when that character falls in the list (0 - 7).· If not in the list, then we loop back to the top to get another character.· If the character was valid, the new value of cmd is divided by two (because we used two characters for each command: uppercase and lowercase).· No it's a simple matter of calling the appropriate subroutine with ON-GOSUB.

    Once you understand how this works you can easily expand the list.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • HavoKaneHavoKane Posts: 109
    edited 2005-04-30 17:43
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    cmd··· VAR··· Byte

    Get_Command:
    · DEBUGIN cmd
    · LOOKDOWN cmd, [noparse][[/noparse]"fFbBlLrR"], cmd

    · IF (cmd > 7) THEN Get_Command
    ··· cmd = cmd / 2

    · ON cmd GOSUB Go_Fwd, Go_Back, Go_Left, Go_Right
    ··· GOTO Get_Command

    Go_FWD:
    · PULSOUT 13, 850
    · PULSOUT 12, 650

    Go_Left:
    ··· PULSOUT 13, 650
    ··· PULSOUT 12, 650

    Go_Right:
    ··· PULSOUT 13, 850
    ··· PULSOUT 12, 850

    Go_Back:
    ··· PULSOUT 13, 650
    ··· PULSOUT 12, 850



    thats all i could think of but it doesnt work. what do i need to change?

    Post Edited (HavoKane) : 4/30/2005 7:24:46 PM GMT
  • Microman171Microman171 Posts: 111
    edited 2005-04-30 20:20
    Try this

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    cmd    VAR    Byte
    
    Get_Command:
      DEBUGIN cmd
      LOOKDOWN cmd, [noparse][[/noparse]"fFbBlLrR"], cmd
    
      IF (cmd > 7) THEN Get_Command
        cmd = cmd / 2
    
      ON cmd GOSUB Go_Fwd, Go_Back, Go_Left, Go_Right
        GOTO Get_Command
    
    Go_FWD:
      PULSOUT 13, 850
      PULSOUT 12, 650
    
      return
    
    Go_Left:
        PULSOUT 13, 650
        PULSOUT 12, 650
    
        return
    
    Go_Right:
        PULSOUT 13, 850
        PULSOUT 12, 850
    
        return
    
    Go_Back:
        PULSOUT 13, 650
        PULSOUT 12, 850
    
        return
    
    



    I did test It but I have no BOE-Bot so I used debug

    Micro
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-30 20:56
    You might want to use SERIN on pin 16 with a timeout of 20 milliseconds so that the servos can be updated as required.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Microman171Microman171 Posts: 111
    edited 2005-05-01 02:19
    This is a question from micro

    How do I control through the COM port but have no wires

    Or simply How do I make a Tx for the computer and a Rx for the stamp

    Answering this could help the person who raised the question smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Hello
  • HavoKaneHavoKane Posts: 109
    edited 2005-05-01 06:00
    so my code is ok? i just need to add the serin command? where do i add it?
  • HavoKaneHavoKane Posts: 109
    edited 2005-05-02 11:36
    i tried it with the "RETURN" in there, it didnt work. when i press the keys in debug, the TX and RX lights light up at the same time, but nothing happens to my servos. but eveything works when i just normaly program it
Sign In or Register to comment.