Goal: Create a method where all LEDs on the Protosnap (see image) will blink in order: RGB Red, RGB Green, RGB Blue, LED 5, LED 6, LED A2, LED A4, LED A3.
I know how to do this if I put it in a loop, but I'm not sure how I'd go about doing it if I only wanted the lights to each blink once...
Greatly appreciate any help I can get - thanks in advance
Here's the code I've developed so far:
int LED5 = 5; // LED is connected to digital pin 5
int LED6 = 6; // LED is connected to digital pin 6
int redPin = 9; // R petal on RGB LED module connected to digital pin 11
int greenPin = 11; // G petal on RGB LED module connected to digital pin 9
int bluePin = 10; // B petal on RGB LED module connected to digital pin 10
int delayTime = 200; // delay is 1/5 of a second
void setup(){
pinMode(LED5, OUTPUT); // sets the LED 5 to be an output
pinMode (LED6, OUTPUT); // sets the LED 6 to be an output
pinMode (A2, OUTPUT); // sets the LED A2 to be an output
pinMode (A4, OUTPUT); // sets the LED A4 to be an output
pinMode (A3, OUTPUT); // sets the LED A3 to be an output
pinMode(redPin, OUTPUT);// sets the redPin (9) to be an output
pinMode(greenPin, OUTPUT); // sets the greenPin (11) to be an output
pinMode(bluePin, OUTPUT); // sets the bluePin (10) to be an input
rgbLight (0,0,0);
}
void loop(int red, int green, int blue) { // run forever
}
void rgbLight (int red, int green, int blue){
analogWrite(redPin, 255-100);
analogWrite(bluePin, 255-50);
analogWrite(greenPin, 255-100);
rgbLight(255,0,0); //turn the RGB LED red
delay(delayTime); //delay
rgbLight(0,0,0); //turn the RGB LED red
delay(delayTime); //delay
rgbLight(0,255,0); //turn the RGB LED green
delay(delayTime); //delay
rgbLight(0,0,0); //turn the RGB LED red
delay(delayTime); //delay
rgbLight(0,0,255); //turn the RGB LED blue
delay(delayTime); //delay
rgbLight(0,0,0); //turn the RGB LED red
delay(delayTime); //delay
digitalWrite (LED5, HIGH);
delay (delayTime);
digitalWrite (LED5, LOW);
delay (delayTime);
digitalWrite (LED6, HIGH);
delay (delayTime);
digitalWrite (LED6, LOW);
delay (delayTime);
digitalWrite (A2, HIGH);
delay (delayTime);
digitalWrite (A2, LOW);
delay (delayTime);
digitalWrite (A4, HIGH);
delay (delayTime);
digitalWrite (A4, LOW);
delay (delayTime);
digitalWrite (A3, HIGH);
delay (delayTime);
digitalWrite (A3, LOW);
delay (delayTime);
}
