I have a question regarding a Year 12 school project I am undertaking.
I have a blue LED plugged into a PWM pin (~11) and a green LED plugged into another PWM pin (~10).
I have managed to light up one LED in a fading sequence however I would like both to light up but at different times. And be able to control the time period between each one lighting up.
Any help would be appreciated!
Here is my code so far:
int led1 = 11; // blue LED
int led2 = 10; // green LED
int brightness = 0;
int fadeAmount = 5;
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
}
void loop() {
analogWrite(led1, brightness);
brightness = brightness + fadeAmount;
if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount ;
}
delay(30);
}