Go Down

Topic: Servo help... (Read 836 times) previous topic - next topic

Flia

Hi guys,

I need a servo to be in the "0" position, and then after about 6 hours sweep from 0 to 180 4 times and stop at 0, and then do it all over again.
Is this possible with Arduino?
Could the "sweep" function be modified with maybe a timer of some sort?

David.

PaulS

Quote
I need a servo to be in the "0" position, and then after about 6 hours sweep from 0 to 180 4 times and stop at 0, and then do it all over again.
Is this possible with Arduino?

Sure. Although the "after about 6 hours" adds some complexity. "after 6 hours" would be much easier.

Quote
Could the "sweep" function be modified with maybe a timer of some sort?

The sweep function? If you meant the "sweep" sketch, then yes. There is a function called millis() that returns the time since last reset. You can store the last time the servo waved about wildly, then check whether the current value returned by millis() minus the last servo move time is greater than 6 hours. If not, do nothing. If so, wave like mad and reset the time.
The art of getting good answers lies in asking good questions.

simon.monk

Sorry, I've got to ask.

What is the application?
--
I write books about Arduino and Electronics: http://simonmonk.org

Go Up