Shop OBEX P1 Docs P2 Docs Learn Events
SX bot wheel movement — Parallax Forums

SX bot wheel movement

HenrymouHenrymou Posts: 128
edited 2007-08-11 23:23 in Robotics
ok
I am new to the SX but not robotics
why won't this code move the servos I installed at SX pins RB.7 and RC.7?

DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ 4_000_000
ID "MOTOR_MOVEMENT"

do
PULSOUT RB.7, 800
pause 500
loop

help!
-Henry

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-08-11 01:00
    Henrymou,

    You have --
    do
    PULSOUT RB.7, 800
    
    [color=red][b]pause[/b][/color] [color=red][b]500 [img]http://forums.parallax.com/images/smilies/skull.gif[/img] [/b][/color]
     
    loop
    
    

    Anybody "not new" to robotics would know that the servo refresh rate is 20msec --·but you're pausing for 500msec (1/2 sec.)

    Try PAUSE 19 (maybe PAUSE 20.)
  • BeanBean Posts: 8,129
    edited 2007-08-11 01:03
    800 is WAY too long for the pulsout.
    150 is centered.

    DO
    PULSOUT RB.7, 150
    PAUSE 20
    LOOP

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Teacher: What is the difference between ignorance and apathy ?
    Student: I don't know and I don't care
    Teacher: Correct !
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.hittconsulting.com
    ·
  • HenrymouHenrymou Posts: 128
    edited 2007-08-11 01:05
    the computer tells me the list index is out of bounds, what now?
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-08-11 01:18
    ·
    DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
    FREQ 4_000_000
    
     
    PROGRAM Servos
     
    Servos:
     DO
      PULSOUT RB.7, 150
      pause 20
     LOOP
    
  • HenrymouHenrymou Posts: 128
    edited 2007-08-11 01:22
    WHOO! that finally worked!
    thx PJ Allen, will you b my friend?
  • HenrymouHenrymou Posts: 128
    edited 2007-08-11 01:43
    ok, the servo is moving a little slow, how can I make the servos:
    speed up over time?
    slow down over time?
    and move forward and backward?
    thx
    -Henry
  • FranklinFranklin Posts: 4,747
    edited 2007-08-11 03:21
    Put in a for/next loop that increments and decrements the pulsout value.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • HenrymouHenrymou Posts: 128
    edited 2007-08-11 03:33
    but how do I make the servos go forward and backward usin' SX/B code?
  • D FaustD Faust Posts: 608
    edited 2007-08-11 12:25
    DO
    FOR pulse = 100 to 200
     PULSOUT RB.7, pulse
     PAUSE 20
    NEXT
    FOR pulse = 200 to 100
     PULSOUT RB.7, pulse PAUSE 20
    NEXT
    
    LOOP
    

    If it is like PBASIC then this would make the servo go all the way one way to all the way the other way and back.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    LOOKDOWN ThisThread, [noparse][[/noparse]Your_?, My_?, Cool_Thing], looknum
    LOOKUP looknum, [noparse][[/noparse]1, 2, 3], subnum
    ON subnum GOTO Hope_this_helps, Thanks!, WOW!!
    END 
    
  • HenrymouHenrymou Posts: 128
    edited 2007-08-11 21:19
    yeah, but that program ain't working, I think you have a typo, yet I don't know what it is.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-08-11 22:20
    henrymou,

    Is this a "continuous" or a standard servo?
  • HenrymouHenrymou Posts: 128
    edited 2007-08-11 22:21
    oh, neva mind, I added
    pulse var byte
    at da top of the program, and now it works
    thanks!

    can I have a few example subroutines, then I will have no more questions
    you know
    like
    Forward
    Left
    Right
    Backwards
    and so on
    thx
    -Henry
  • D FaustD Faust Posts: 608
    edited 2007-08-11 23:23
    At least try to make up the subroutines, and if they don't work then post for someone to check them.··People on this forum usually don't want to do the work for you, but will help you through it.· Are you experienced in PBASIC?· What I gave you was just the same type of code I use for my boe-bot (which is PBASIC, I have NO experience with SX/B).· For a start with those subroutines, 100 is full one way, 150 is center, and 200 is full the other way. To find out the directions just do a couple of tests.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    LOOKDOWN ThisThread, [noparse][[/noparse]Your_?, My_?, Cool_Thing], looknum
    LOOKUP looknum, [noparse][[/noparse]1, 2, 3], subnum
    ON subnum GOTO Hope_this_helps, Thanks!, WOW!!
    END 
    
Sign In or Register to comment.