- Get link
- X
- Other Apps
Led Chaser Circuit Using Arduino
Full video
CODE
//www.youtube.com/DIY ELECTRIX//
//www.facebook.com/DIY ELECTRIX//
//Project by RAJAT//
int pinsCount=12; // declaring the integer variable pinsCount
int pins[] = {2,3,4,5,6,7,8,9,10,11,12,13}; // declaring the array pins[]
void setup() {
for (int i=0; i<pinsCount; i=i+1){ // counting the variable i from 0 to 9
pinMode(pins[i], OUTPUT); // initialising the pin at index i of the array of pins as OUTPUT
}
}
void loop() {
for (int i=0; i<pinsCount; i=i+1){ // chasing right
digitalWrite(pins[i], HIGH); // switching the LED at index i on
delay(100); // stopping the program for 100 milliseconds
digitalWrite(pins[i], LOW); // switching the LED at index i off
}
for (int i=pinsCount-1; i>0; i=i-1){ // chasing left (except the outer leds)
digitalWrite(pins[i], HIGH); // switching the LED at index i on
delay(100); // stopping the program for 100 milliseconds
digitalWrite(pins[i], LOW); // switching the LED at index i off
}
}
- Get link
- X
- Other Apps
Comments
Led light in pakistan Cecon Engineering being one of the top LED brands in Pakistan to provides you one of the best-LED lights in Pakistan to make your life lighten with our cheapest LED light
ReplyDelete