Author Options:

I need arduino code to trigger servos.? Answered

Alright I've been looking at this for a while and haven't been able to figure it out well, and I need this project done soon.

Basically using the arduino servo library I want to trigger one or more servos to do to the positions I want for a period of time, so I need it to do multiple servos simultaniously, however I also need it to process multiple button presses (and servo sequences) at the same time, not sure if thats a problem or not. It would be a huge help.


What experience have you had writing code ? What you want it really pretty simple.

I'm pretty good with writing code, when I figure it out, but I havent done much with anything like arduino programming and its confusing. Really I jsut need a sample of a button press triggering a servo to move to whatever position for however long then back, and I'll be able to write up whatever I need from that.

Have you started here ?


yup, and I've been able to controll a servo, I'm just having a bit of trouble figuring out how to get the button press to tigger it.

A button press is a change in state of a digital pin. Tie your button to a pin: define it in your sketch

If button== 1 then {move servo}

//THIS is inportant.

While button == 1 do {}; //wait for button to be released