Arduino Forum

Topics => Robotics => Topic started by: baron989 on Mar 06, 2016, 05:54 pm

Title: How to perform a task for a specific time duration
Post by: baron989 on Mar 06, 2016, 05:54 pm
HI
Is there a library of code function that can allow me to do a specific task for a given time period. For example, I want to do the sweep function in a servo motor for only 30 seconds, then wait 1 minutes, and then resume the sweep function for 30 seconds
Title: Re: How to perform a task for a specific time duration
Post by: PaulS on Mar 07, 2016, 03:10 pm
Quote
Is there a library of code function that can allow me to do a specific task for a given time period.
There isn't a library needed for such a simple task.

Think about how you would perform the task. You have a pencil and paper (some variables) and a watch. You need to make the servo move for 30 seconds. What are some of the steps that you need to perform?

When you can define that list, the blink without delay example gives some clues how to make the Arduino do the list of things you have come up with.