3 separate programm timers

Hi, guys! I'm newbie in arduino. Can you help me with sketch, please.

Basically, I have Algorhytm:

  • wait 3 min
  • turn on led1
  • wait 3 min
  • Turn off led1
  • turn on led2
  • wait 3 min
  • turn off led2
  • turn on led3
  • wait untill button is pressed, then repeat actions

The difficulty is: I need 3 independent "timers" to use with this algorhytm. - Start timer1 when button1 is pressed. - (run algorhytm with LEDS) - Stop and reset timer1 when button1 is released

  • Start timer2 when button2 is pressed.
  • (run algorhytm with LEDS)
  • Stop and reset timer2 when button2 is released

  • Start timer3 when button3 is pressed.

  • (run algorhytm with LEDS)

  • Stop and reset timer3 when button3 is released

And i'm stucked. I tried to use http://playground.arduino.cc/Code/Timer timer library But cat understand the basic structure of the sketch.

Here is example od two led blinking.

//Flash two LEDs at different rates using Simon Monk's Timer library
//Jack Christensen 30Sep2013
//Beerware license: Free for any and all purposes, but if you find it
//useful AND we actually meet someday, you can buy me a beer!

#include "Timer.h"                     //http://github.com/JChristensen/Timer

const int LED1 = 8;                    //connect one LED to this pin (with appropriate current-limiting resistor of course)
const int LED2 = 9;                    //connect another LED to this pin (don't forget the resistor)
const unsigned long PERIOD1 = 1000;    //one second
const unsigned long PERIOD2 = 10000;   //ten seconds
Timer t;                               //instantiate the timer object

void setup(void)
    pinMode(LED1, OUTPUT);
    pinMode(LED2, OUTPUT);
    t.oscillate(LED1, PERIOD1, HIGH);
    t.oscillate(LED2, PERIOD2, HIGH);

void loop(void)

Where to add timer.disable, timer.enabled and how to make several separate timers. Which starts and turns off by individual buttons? Thanks a lot for your help!

Why do you need timers? How would you, using nothing but your wrist watch, boil a three minute egg, make a piece of toast that takes a minute and a half to brown, and cook bacon that takes 10 minutes to cook, all at the same time?

List the exact steps you’d follow.

I'm afraid my explanation make it even more difficult to understant.

I need to show(using 3 led) how long the button is pressed. And I have 3 buttons, which can be pressed in the differnt time(they can be pressed together, or it can be only one button, wich will be pressed, they can be pressed one by one or other combinations 3rd button can, for example be pressed for a ten minutes, while 1st at the same time can be pressed 5 times (2 min each))

In the IDE go File > Examples > 02.Digital > Blinkwithoutdelay. Read and understand. Use different variables for each process you need to time.

Thanks! It works for me!