Shop OBEX P1 Docs P2 Docs Learn Events
IR help — Parallax Forums

IR help

ArchiverArchiver Posts: 46,084
edited 2004-01-28 21:59 in General Discussion
I have an IR control that controls 1 servo. I have to use 2 buttons to open and
close the claw but onlly to 2 positions. Could anybody give me an example of how
to program the servo to move a little bit each time the button is pressed
instead of just 2 positions.


Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-01-28 16:06
    In a message dated 1/28/2004 10:57:22 AM Eastern Standard Time,
    crazykurby@y... writes:


    > I have an IR control that controls 1 servo. I have to use 2 buttons to open
    > and close the claw but onlly to 2 positions. Could anybody give me an
    > example of how to program the servo to move a little bit each time the button
    is
    > pressed instead of just 2 positions.
    >

    I presume your servo is going from something like 650 to something like 850.
    Tray pulsouting the servo at perhaps 760 or 765 and see what happens.

    Sid


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-01-28 16:13
    This little example assumes that you're controlling the servo directly,
    so it does a manual refresh:


    Main:
    DO
    GOSUB Get_Buttons ' scan buttons
    (1 = pressed)
    IF btns.BIT0 THEN clawPos = clawPos + 50 MAX 1000 ' open a bit
    IF btns.BIT1 THEN clawPos = clawPos - 50 MIN 500 ' close a bit
    PULSOUT ClawPin, clawPos ' refresh
    servo
    PAUSE 20
    LOOP


    You'll need to add a subroutine to deal with your buttons. If you don't
    have one handy, download the StampWorks book as a PDF. It has an
    experiment that shows how to scan a debounce multiple buttons in a
    single routine.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: Kyle Cooper [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=jd6Uq1eTw0EL859mvFmRvrUQE6Z8Yu9rFztvfH44M6CxVQ3l9w8Icm7IeIXQ0RSefDftnUfFzoX4kFsi410]crazykurby@y...[/url
    Sent: Wednesday, January 28, 2004 7:16 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] IR help


    I have an IR control that controls 1 servo. I have to use 2 buttons to
    open and close the claw but onlly to 2 positions. Could anybody give me
    an example of how to program the servo to move a little bit each time
    the button is pressed instead of just 2 positions.
  • ArchiverArchiver Posts: 46,084
    edited 2004-01-28 21:59
    Thanks Jon

    Jon Williams <jwilliams@p...> wrote:This little example assumes that
    you're controlling the servo directly,
    so it does a manual refresh:


    Main:
    DO
    GOSUB Get_Buttons ' scan buttons
    (1 = pressed)
    IF btns.BIT0 THEN clawPos = clawPos + 50 MAX 1000 ' open a bit
    IF btns.BIT1 THEN clawPos = clawPos - 50 MIN 500 ' close a bit
    PULSOUT ClawPin, clawPos ' refresh
    servo
    PAUSE 20
    LOOP


    You'll need to add a subroutine to deal with your buttons. If you don't
    have one handy, download the StampWorks book as a PDF. It has an
    experiment that shows how to scan a debounce multiple buttons in a
    single routine.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: Kyle Cooper [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=wmlDFu_JJnIMDyI4KLJ8eIYlnGTApuNpoaKzcbmr4XH4IOFw5z51Diw6xEwM1y1klCvCLXgB7WBul62vgEc]crazykurby@y...[/url
    Sent: Wednesday, January 28, 2004 7:16 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] IR help


    I have an IR control that controls 1 servo. I have to use 2 buttons to
    open and close the claw but onlly to 2 positions. Could anybody give me
    an example of how to program the servo to move a little bit each time
    the button is pressed instead of just 2 positions.


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and Body of
    the message will be ignored.


    Yahoo! Groups Links

    To visit your group on the web, go to:
    http://groups.yahoo.com/group/basicstamps/

    To unsubscribe from this group, send an email to:
    basicstamps-unsubscribe@yahoogroups.com

    Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/




    Do you Yahoo!?
    Yahoo! SiteBuilder - Free web site building tool. Try it!

    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.