Knight rider light using arduino uno board
Source code
const int LED1 = 2;
const int LED2 = 3;
const int LED3 = 4;
const int LED4 = 5;
const int LED5 = 6;
const int LED6 = 7;
const int LED7 = 8;
const int LED8 = 9;
const int LED9 = 10;
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);
pinMode(LED9,OUTPUT);
}
void loop() {
digitalWrite(LED1, HIGH);
digitalWrite(LED2, HIGH);
delay(50);
digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW);
delay(50);
digitalWrite(LED2, HIGH);
digitalWrite(LED3, HIGH);
delay(50);
digitalWrite(LED2, LOW);
digitalWrite(LED3, LOW);
delay(50);
digitalWrite(LED3, HIGH);
digitalWrite(LED4, HIGH);
delay(50);
digitalWrite(LED3, LOW);
digitalWrite(LED4, LOW);
delay(50);
digitalWrite(LED4, HIGH);
digitalWrite(LED5, HIGH);
delay(50);
digitalWrite(LED4, LOW);
digitalWrite(LED5, LOW);
delay(50);
digitalWrite(LED5, HIGH);
digitalWrite(LED6, HIGH);
delay(50);
digitalWrite(LED5, LOW);
digitalWrite(LED6, LOW);
delay(50);
digitalWrite(LED6, HIGH);
digitalWrite(LED7, HIGH);
delay(50);
digitalWrite(LED6, LOW);
digitalWrite(LED7, LOW);
delay(50);
digitalWrite(LED7, HIGH);
digitalWrite(LED8, HIGH);
delay(50);
digitalWrite(LED7, LOW);
digitalWrite(LED8, LOW);
delay(50);
digitalWrite(LED8, HIGH);
digitalWrite(LED9, HIGH);
delay(50);
digitalWrite(LED8, LOW);
digitalWrite(LED9, LOW);
delay(50);
digitalWrite(LED9, HIGH);
delay(50);
digitalWrite(LED9, LOW);
delay(50);
digitalWrite(LED9, HIGH);
digitalWrite(LED8, HIGH);
delay(50);
digitalWrite(LED9, LOW);
digitalWrite(LED8, LOW);
delay(50);
digitalWrite(LED8, HIGH);
digitalWrite(LED7, HIGH);
delay(50);
digitalWrite(LED8, LOW);
digitalWrite(LED7, LOW);
delay(50);
digitalWrite(LED7, HIGH);
digitalWrite(LED6, HIGH);
delay(50);
digitalWrite(LED7, LOW);
digitalWrite(LED6, LOW);
delay(50);
digitalWrite(LED6, HIGH);
digitalWrite(LED5, HIGH);
delay(50);
digitalWrite(LED6, LOW);
digitalWrite(LED5, LOW);
delay(50);
digitalWrite(LED5, HIGH);
digitalWrite(LED4, HIGH);
delay(50);
digitalWrite(LED5, LOW);
digitalWrite(LED4, LOW);
delay(50);
digitalWrite(LED4, HIGH);
digitalWrite(LED3, HIGH);
delay(50);
digitalWrite(LED4, LOW);
digitalWrite(LED3, LOW);
delay(50);
digitalWrite(LED3, HIGH);
digitalWrite(LED2, HIGH);
delay(50);
digitalWrite(LED3, LOW);
digitalWrite(LED2, LOW);
delay(50);
digitalWrite(LED2, HIGH);
digitalWrite(LED1, HIGH);
delay(50);
digitalWrite(LED2, LOW);
digitalWrite(LED1, LOW);
delay(50);
digitalWrite(LED1, HIGH);
delay(50);
digitalWrite(LED1, LOW);
delay(50);
digitalWrite(LED1, HIGH);
digitalWrite(LED2, HIGH);
delay(50);
digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW);
delay(50);
// put your main code here, to run repeatedly:
}
Comments
Post a Comment