Shop OBEX P1 Docs P2 Docs Learn Events
Pulsout troubles — Parallax Forums

Pulsout troubles

ArchiverArchiver Posts: 46,084
edited 2003-01-06 18:38 in General Discussion
Happy new year to all,

My project is to make a robotic arm using modified servos.
The program that I wrote is the following:


input 0
high 0
input 1
high 1

get_status:

if in0 = 0 then up
if in1 = 0 then down
goto get_status

up:
low 2
pulsout 2 , 1000
pause 20
goto get_status

down:
low 2
pulsout 2 , 500
pause 20
goto get_status

The problem is that servos turning counterclockwise
eather I press the 1st button or I press the 2nd button.
What sould I do to make them turning both clockwise and
counterclockwise ?

Thank you,

Thomas





Do You Yahoo!?

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-01-05 23:39
    "pulsout 2,1000" should make the servo turn counterclockwise.
    "pulsout 2,500" should make it turn clockwise.


    --- In basicstamps@yahoogroups.com, tik tak <th_sak@y...> wrote:
    >
    > Happy new year to all,
    >
    > My project is to make a robotic arm using modified servos.
    > The program that I wrote is the following:
    >
    >
    > input 0
    > high 0
    > input 1
    > high 1
    >
    > get_status:
    >
    > if in0 = 0 then up
    > if in1 = 0 then down
    > goto get_status
    >
    > up:
    > low 2
    > pulsout 2 , 1000
    > pause 20
    > goto get_status
    >
    > down:
    > low 2
    > pulsout 2 , 500
    > pause 20
    > goto get_status
    >
    > The problem is that servos turning counterclockwise
    > eather I press the 1st button or I press the 2nd button.
    > What sould I do to make them turning both clockwise and
    > counterclockwise ?
    >
    > Thank you,
    >
    > Thomas
    >
    >
    >
    >
    >
    >
    > Do You Yahoo!?
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-06 18:38
    I rewrote the program with some changes but I still have problem.
    (I had pullup resistors in series to buttons).
    Note that both servos are modified to turn continuously
    but with these commands they sould turn to both sides.

    'Robotic arm project

    '
    Initialization

    input 0 'Set P0 to input
    input 1 'Set P1 to input
    low 2 'Set P2 to output-low

    '
    Main routine

    get_status:
    if in0 = 0 then up
    if in1 = 0 then down
    goto get_status

    '
    Full speed reverse

    up: 'Turn counterclockwise
    pulsout 2 , 500 'Send 1.0 ms pulses to P2
    pause 20 'every 20 ms.
    debug " arm up " 'Open the debug window and display arm up.

    goto get_status 'Go to get_status

    '
    Full speed ahead

    down: 'Turn clockwise
    pulsout 2 , 1000 'Send 2.0 ms pulses to P2
    pause 20 'every 20 ms.
    debug " arm down " 'Open the debug window and display arm down.

    goto get_status 'Go to get_status

    Thanks again,
    Thomas




    Do You Yahoo!?
Sign In or Register to comment.