Flashing LED's with specific delays

Hi Arduino's!

I've just started a little project for myself here.

I've bought an Arduino Duemilanove and some LED's.

My goal is to have to flashing LED's, that each flashes with some specific pauses.

I've setup two timers to control each function - blink01() and blink02().

So my goal is that each time blink01 is called the first LED is going like this: ON (1 sec.), OFF, (1 second), ON (0.2 seconds), OFF (1 second).

My question is; what would be the smartest way to control this "off" flashing?

Best regards, Rail.

raili0n: I've setup two timers

What does that mean? Let's see them...

raili0n: what would be the smartest way to control this "off" flashing?


Hi Jimbo,

Thank you for your swift reply.

My code looks as following. Don’t mind the comments - they’re mostly in danish. In my blink01 function, I’ve tried to explain what I’m trying to achieve.

//Her inkluderer vi det bibliotek, som indholder vores timer
#include <SimpleTimer.h>

//Her sætter vi de to timere op, som skal styre hver deres "lys bøjer"
// Vi kalder biblioteket ved at skrive "Simple Timer" og navngiver derefter vores timer "timer1" og "timer2"
SimpleTimer timer1;
SimpleTimer timer2;

void setup() {
  // Her angiver vi, at vi skal arbejde med pin 12 og pin 13
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);

  //Her angiver vi, at vi skal arbejde med de to timere, som vi satte op tidligere
  //Vi angiver, at de skal kalde hver vores blink funktion
  timer1.setInterval(3200, blink01);
  timer2.setInterval(3000, blink02);

void loop() {
  // put your main code here, to run repeatedly:


void blink01() {
  digitalWrite(13, HIGH);
  //Wait 1 second
  digitalWrite(13, LOW);
  //Wait 1 second
  digitalWrite(13, HIGH);
  //Wait 0.2 seconds
  digitalWrite(13, LOW);
  //Wait 1 second

void blink02() {

You are going about it all wrong. You can not do what you want with those timers because you will block the action of one timer with the called function of the other. You need to write the whole thing as a state machine and forget the timers. http://www.thebox.myzen.co.uk/Tutorial/State_Machine.html