J-M-L:
here is an old example I had written with an array of durations between "tics"
you can run it with the console at 115200 bauds and it will print info at after pausing for a time as defined in the ticDuration
array (in ms)
const unsigned int ticDuration[] = {1000, 1500, 2000, 200};
const byte nbTics = sizeof(ticDuration) / sizeof(ticDuration[0]);
byte tic;
unsigned long chrono;
void setup() {
Serial.begin(115200);
tic = 0;
chrono = 0;
}
void loop() {
unsigned long int currentMillis = millis();
if (currentMillis - chrono > ticDuration[tic]) {
Serial.print(tic);
Serial.print("\t(");
Serial.print(ticDuration[tic]);
Serial.print(")\t");
Serial.println(millis());
chrono = currentMillis;
tic = (tic + 1) % nbTics; // next duration and rollover
}
}
you'll see it's not accurate to the ms due to all the printing and extra code and possibly millis() rounding error but "good enough" at respecting the pause in between 2 consecutive ticks (it print the value of millis() and expected pause so you can see it does wait the right amount of time
<sub>```</sub>
<sub>tic duration millis()
0 (1000) 1001 --> duration 1000, triggered at millis = 1001
1 (1500) 2502 --> duration 1500, triggered at millis = 2502, so ~1500 ms delay
2 (2000) 4503 --> duration 2000, triggered at millis = 4503, so ~2000 ms delay
3 (200) 4704 --> duration 200, triggered at millis = 4704, so ~200 ms delay
0 (1000) 5705 etc..
1 (1500) 7206
2 (2000) 9207
3 (200) 9408
```
Thanks to both of you for replying and helping me 
Ive edited the code a little bit to fit my needs:
#define LED D0 //the led is on pin D0/16
const unsigned int ticDuration[] = {100, 150, 100, 1000}; //added my own delays
const byte nbTics = sizeof(ticDuration) / sizeof(ticDuration[0]);
byte tic;
unsigned long chrono;
unsigned long lastPass = 0;
int state = 0;
void setup() {
pinMode(LED, OUTPUT);
Serial.begin(115200);
tic = 0;
chrono = 0;
digitalWrite(LED, HIGH); //turn off led after initializing
}
void loop() {
unsigned long int currentMillis = millis();
if( currentMillis - chrono > ticDuration[tic]) {
ledtoggle();
//Serial.print(tic); // <-- avoid serial console spam
//Serial.print("\t(");
//Serial.print(ticDuration[tic]);
//Serial.print(")\t");
//Serial.println(millis());
chrono = currentMillis;
tic = (tic + 1) % nbTics; //next duration and roll over
}
}
void ledtoggle() { //toggle led
digitalWrite(LED, (!state) ? HIGH : LOW); //!state because otherwise the led would be inverted
state = !state; //toggle the state function to switch the led state
}
Works just fine, now I need to implement it into my other project but that should work just fine as well.