- AR-B1: Blinking LED Project using Arduino
- AR-B2: Alternate Control of LED & Buzzer
- AR-B3: Alternate Blinking LEDs
- AR-B4: Running Effect of LEDs
- AR-B5: Chasing Effect of LEDs
- AR-B6: Obstacle Detector using IR Sensor
- AR-B7: Object Counter using Serial Monitor
- AR-B8: Servo Motor Basic Code
- AR-B10: Car Wiper System using Servo Motor
- B13: LED Display Down Counter with Alarm using Arduino
- Protected: Day-1: Online Course on Arduino Programing with Practicals
- Protected: Day-2: Online Course on Arduino Programing with Practicals
- Protected: Day-3: Online Course on Arduino Programing with Practicals
In this code we use 4 LEDs connected on breadboard with 4 resistors of 1kΩ. This code produces the effect of running LEDs.
Required Material
Arduino UNO Board – 1, data cable – 1, Red LEDs – 4, Jumper wires – 5, 1kΩ resistor (Brown Black Red) – 4.
Working
After uploading the code in Arduino UNO board, LED1, LED2, LED3 and LED4 will be ON one-by-one. Thus each LED will be ON in sequence and then all OFF.
The Code
With this code you get the idea of how the decorative effect of LEDs is obtained in DIWALI Series, which we use to decorate our home. Upload the following code and enjoy the beautiful decorative effect of LEDs.
int led1 = 1; int led2 = 2; int led3 = 3; int led4 = 4; void setup() { pinMode(led1,OUTPUT); pinMode(led2,OUTPUT); pinMode(led3,OUTPUT); pinMode(led4,OUTPUT); } void loop() { digitalWrite(led1,HIGH); // 1st digitalWrite(led2,LOW); digitalWrite(led3,LOW); digitalWrite(led4,LOW); delay(100); digitalWrite(led1,LOW); // 2nd digitalWrite(led2,HIGH); digitalWrite(led3,LOW); digitalWrite(led4,LOW); delay(100); digitalWrite(led1,LOW); // 3rd digitalWrite(led2,LOW); digitalWrite(led3,HIGH); digitalWrite(led4,LOW); delay(100); digitalWrite(led1,LOW); // 4th digitalWrite(led2,LOW); digitalWrite(led3,LOW); digitalWrite(led4,HIGH); delay(100); digitalWrite(led1,LOW); // all off digitalWrite(led2,LOW); digitalWrite(led3,LOW); digitalWrite(led4,LOW); delay(100); }