Alone

Lately I have been alone Like a lot of other people. I have been at home But home for me is on my own. No new faces, nor old ones Only sound I hear is keyboard punching. Nobody around to speak to…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How to create knight rider light in Arduino Uno R3

01. List out the items needed for the circuit

Arduino Uno R3, Small Breadboard, 6 Red LEDs, 6 Resistors, Wires

02. Add Arduino Uno R3 and small bread board to the circuit

03.Place 6 LEDs in small breadboard in terminal strips with equal amount of distance between them

04.Place diodes in terminal strips to make connection to Upper and Lower terminals and place them connecting LEDs cathode.

05.Connect GRD pin in Arduino Uno R3 to breadboard’s negative side.

06.Make Connection between negative power rails and anode of the LEDs using wires.

07.Making Connection between resistors and digital pins in Arduino Uno R3

08.Coding part

First lights must be switch on and off from left to right and right to left until power terminated to Arduino Uno R3

int led1 = 7;
int led2 = 6;
int led3 = 5;
int led4 = 4;
int led5 = 3;
int led6 = 2;
const int delayTime = 50;

void setup()
{
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
}

void loop()
{

digitalWrite(led1, HIGH);
delay(delayTime);
digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
delay(delayTime);

digitalWrite(led2, LOW);
digitalWrite(led3, HIGH);
delay(delayTime);

digitalWrite(led3, LOW);
digitalWrite(led4, HIGH);
delay(delayTime);

digitalWrite(led4, LOW);
digitalWrite(led5, HIGH);
delay(delayTime);

digitalWrite(led4, LOW);
digitalWrite(led5, HIGH);
delay(delayTime);

digitalWrite(led5, LOW);
digitalWrite(led6, HIGH);
delay(delayTime);

digitalWrite(led6, LOW);
digitalWrite(led5, HIGH);
delay(delayTime);

digitalWrite(led5, LOW);
digitalWrite(led4, HIGH);
delay(delayTime);

digitalWrite(led4, LOW);
digitalWrite(led3, HIGH);
delay(delayTime);

digitalWrite(led3, LOW);
digitalWrite(led2, HIGH);
delay(delayTime);

digitalWrite(led2, LOW);
digitalWrite(led1, HIGH);
delay(delayTime);;

digitalWrite(led1, LOW);

Add a comment

Related posts:

How to implement sound waves in Android by using ZEGOCLOUD SDK

This article explains how to achieve the sound wave effect in live broadcast, voice chat, call and other scenarios

When Stress Wants to Claim Too Much Space

I have had to navigate stress most of my life, which has left me with debilitating health challenges. I don’t have complaints. I’m always grateful for the goodness in my life. In fact, the health…

BECOME A SMARTER INVESTOR

Understanding finance is an essential skill that can have a significant impact on our lives. Many people tend to shy away from finance because they believe it’s too complicated or they don’t have a…