But what did I do wrong with that loop then...
Unlooped for the third as well:
#include <FadeLed.h>
//91 step sine table 0 = 0 degree, 90 = 90 degree
const flvar_t SineTable[91] PROGMEM = {
0, 4, 9, 13, 18, 22, 27, 31, 35, 40,
44, 49, 53, 57, 62, 66, 70, 75, 79, 83,
87, 91, 96, 100, 104, 108, 112, 116, 120, 124,
127, 131, 135, 139, 143, 146, 150, 153, 157, 160,
164, 167, 171, 174, 177, 180, 183, 186, 190, 192,
195, 198, 201, 204, 206, 209, 211, 214, 216, 219,
221, 223, 225, 227, 229, 231, 233, 235, 236, 238,
240, 241, 243, 244, 245, 246, 247, 248, 249, 250,
251, 252, 253, 253, 254, 254, 254, 255, 255, 255,
255};
//Make FadeLed object with a sine lookup table of 91 (0 to 90 including)
FadeLed sines[3] = {{3, SineTable, 90}, {5, SineTable, 90}, {9, SineTable, 90}};
const byte NrSines = sizeof(sines)/sizeof(sines[0]);
void setup(){
Serial.begin(115200);
for(byte i = 0; i < NrSines; i++){
sines[i].setTime(1000); //halve period, 0% to 90% or 90% to 0%
}
//start the first
sines[0].on();
}
void loop(){
FadeLed::update();
for(byte i = 0; i < NrSines; i++){
//if sin is 100% (90 degree), fade back down
if(sines[i].done() && sines[i].get()){
sines[i].off();
}
}
if((sines[0].getCurrent() >= 45) && sines[1].done() && (sines[1].get() == 0)){
sines[1].on();
}
if((sines[1].getCurrent() >= 45) && sines[2].done() && (sines[2].get() == 0)){
sines[2].on();
}
}