Shop OBEX P1 Docs P2 Docs Learn Events
new to the basic stamp. programing question — Parallax Forums

new to the basic stamp. programing question

NicolNicol Posts: 1
edited 2009-04-29 01:38 in BASIC Stamp
I am trying to program the basic stamp to do a specific function and i am not sure how. right now I have the servo and an led connected with two push buttons. the led is always on and when you press one button the servo moves counter clockwise and when you press the other it moves clockwise. I would like to only have one push button and when it is pressed the led turns on and the servo moves counter clockwise, when the button is released the servo returns to its original position and the led turns off again. how do I do that? thank you

Comments

  • rixterrixter Posts: 95
    edited 2009-04-29 01:38
    It sounds like you are working on the "Controlling Motion" chapter of "What's a Microcontroller?". If your LED is in the circuit path for the servo, your LED should be lighting only when you are pressing a button. You probably have a loop implemented to send PULSEOUT to move the servo and it that loop you should have limits in the range so you aren't trying to move the server further than it's physical limits. You could modify your code so instead of waiting for the second button to be pressed, you are dropping through to that code if the check for the first button returns a non-response.

    If we could see your code we could help more.

    RJL
Sign In or Register to comment.