This circuit is designed to control a sequence of eight red LEDs using an Arduino UNO microcontroller. Each LED is connected to a digital output pin on the Arduino through a 200 Ohm resistor. The LEDs light up in a sequence, creating a simple lighting pattern as dictated by the embedded code running on the Arduino UNO.
/*
* This Arduino Sketch controls 8 LEDs connected to an Arduino UNO.
* The LEDs will light up in a sequence, creating a simple lighting pattern.
*/
int led1 = 1;
int led2 = 2;
int led3 = 3;
int led4 = 4;
int led5 = 5;
int led6 = 6;
int led7 = 7;
int led8 = 8;
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
pinMode(led7, OUTPUT);
pinMode(led8, OUTPUT);
}
void loop() {
int t = 100; // delay time in milliseconds
digitalWrite(led1, HIGH);
delay(t);
digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
delay(t);
digitalWrite(led2, LOW);
digitalWrite(led3, HIGH);
delay(t);
digitalWrite(led3, LOW);
digitalWrite(led4, HIGH);
delay(t);
digitalWrite(led4, LOW);
digitalWrite(led5, HIGH);
delay(t);
digitalWrite(led5, LOW);
digitalWrite(led6, HIGH);
delay(t);
digitalWrite(led6, LOW);
digitalWrite(led7, HIGH);
delay(t);
digitalWrite(led7, LOW);
digitalWrite(led8, HIGH);
delay(t);
digitalWrite(led8, LOW);
}
This code is designed to sequentially turn on and off each LED connected to the digital pins D1 to D8 of the Arduino UNO. The setup()
function initializes these pins as outputs. The loop()
function then turns each LED on and off in sequence with a delay of 100 milliseconds between each action.