Using Arduino I programmed the LED array to turn on all of the Red LEDs delay 1000 milliseconds the turn on all of the Green LEDs and then repeat. Here is the final .PDE file.
/* Alternatively Light Rows of a LED Array */
// Set pin numbers:
int ARLEDpin = 4; // LED Row 1 from Left
int BGLEDpin = 3; // LED Row 2 from Left
int CRLEDpin = 2; // LED Row 3 from Left
int DGLEDpin = A5; // LED Row 4 from Left
int ERLEDpin = A4; // LED Row 5 from Left
int FGLEDpin = A2; // LED Row 6 from Left
int GRLEDpin = A1; // LED Row 7 from Left
int HGLEDpin = A0; // LED Row 8 from Left
void setup() {
// initialize the LED pin as an output:
pinMode(ARLEDpin, OUTPUT);
pinMode(BGLEDpin, OUTPUT);
pinMode(CRLEDpin, OUTPUT);
pinMode(DGLEDpin, OUTPUT);
pinMode(ERLEDpin, OUTPUT);
pinMode(FGLEDpin, OUTPUT);
pinMode(GRLEDpin, OUTPUT);
pinMode(HGLEDpin, OUTPUT);
}
void loop(){
// turn RED LEDs ON:
digitalWrite(ARLEDpin, HIGH);
digitalWrite(CRLEDpin, HIGH);
digitalWrite(ERLEDpin, HIGH);
digitalWrite(GRLEDpin, HIGH);
digitalWrite(BGLEDpin, LOW);
digitalWrite(DGLEDpin, LOW);
digitalWrite(FGLEDpin, LOW);
digitalWrite(HGLEDpin, LOW);
delay (1000);
// turn GREEN LEDs ON:
digitalWrite(ARLEDpin, LOW);
digitalWrite(CRLEDpin, LOW);
digitalWrite(ERLEDpin, LOW);
digitalWrite(GRLEDpin, LOW);
digitalWrite(BGLEDpin, HIGH);
digitalWrite(DGLEDpin, HIGH);
digitalWrite(FGLEDpin, HIGH);
digitalWrite(HGLEDpin, HIGH);
delay (1000);
} |