De code van het effectje in het filmpje:
int ledPin9 = 9;
int ledPin10 = 10;
int ledPin11 = 11;
int timer_on = 20;
int timer_off =10;
void setup() {
}
void loop() {
for(int fadeValue = 0 ; fadeValue <= 200; fadeValue +=50) {
analogWrite(ledPin9, fadeValue);
delay(timer_on);
}
for(int fadeValue = 200 ; fadeValue >= 0; fadeValue -=50) {
analogWrite(ledPin9, fadeValue);
delay(timer_off);
}
for(int fadeValue = 0 ; fadeValue <= 200; fadeValue +=50) {
analogWrite(ledPin10, fadeValue);
delay(timer_on);
}
for(int fadeValue = 200 ; fadeValue >= 0; fadeValue -=50) {
analogWrite(ledPin10, fadeValue);
delay(timer_off);
}
for(int fadeValue = 0 ; fadeValue <= 200; fadeValue +=50) {
analogWrite(ledPin11, fadeValue);
delay(timer_on);
}
for(int fadeValue = 200 ; fadeValue >= 0; fadeValue -=50) {
analogWrite(ledPin11, fadeValue);
delay(timer_off);
}
for(int fadeValue = 0 ; fadeValue <= 200; fadeValue +=50) {
analogWrite(ledPin10, fadeValue);
delay(timer_on);
}
for(int fadeValue = 200 ; fadeValue >= 0; fadeValue -=50) {
analogWrite(ledPin10, fadeValue);
delay(timer_off);
}
for(int fadeValue = 0 ; fadeValue <= 200; fadeValue +=50) {
analogWrite(ledPin9, fadeValue);
delay(timer_on);
}
for(int fadeValue = 200 ; fadeValue >= 0; fadeValue -=50) {
analogWrite(ledPin9, fadeValue);
delay(timer_off);
}
}
.