Use of 4 timers without delay()-function

Hi,

i have problem programming my Arduino Uno for my DSLR-slider project.

I have to accomplish this function:

  • pushbutton starts the function
  • output A (motor) is active for time 1
  • after time 1, there is a delay time 2
  • after time 2, output B (DSLR) is active for time 3
  • after time 3, there is a delay time 4 and the program starts to repeat

|-------------|------------------|-----------------------|--------------------|-------------------->
Output A delay 1 Output B delay 2 Output A.......

I´ve justed started working with Arduino, so I tried the delay()-function. But it didn´t worked well, because I couldn´t use my pushbuttons because of the delay-functions...

I´ve already looked up the BlinkWithoutDelay-example and some of the timers in the Libraries, but none of them seemed easy or suitable...

I don't know why you think otherwise, but the blink without delay example seems to me to be a perfect starting point for your project.
Other useful search terms might be "state machine"

BlueGene:
it didn´t worked well, because I couldn´t use my pushbuttons because of the delay-functions...

In your description, you didn't mention anything about the behaviour if the button is pressed before the cycle is complete. What do you intend to happen?

It´s about the mainswitch to pause or cancel the program. There are also other programparts, which have to work and shouldn´t be stopped. Like the LCD-display, which is showing the remaining time. With the delay()-function this wouldn´t work...

With the delay()-function this wouldn´t work...

That's why we don't use it and use the concepts introduced in the blink without delay example instead.

I´ve tried the BlinkWithoutDelay-example. But I didn´t understand how to use it with 4 different timers and how to setup the time of the output-ON and the time between the output-ON. The example is just 1 second on and 1 second off. But for example I would need: 1 second on, 3 seconds off.

So, when you change the state of the LED, change the value of "interval" too.

To do similar things, but with minor differences like timings, arrays are a useful technique to learn.