Arduino Flowing Light

Arduino Flowing Light Demonstration

Hardware equipment

arduino uno,led10,220 ohm resistor10,several DuPont wires

Circuit connection:

The circuit connection is shown in the figure:

Code display:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
The code for flowing light is as follows:

int a,b,i;
void setup()
{
for(i=3;i<=12;i++)
pinMode(i, OUTPUT);//Declare 10 LED lights as outputs
}
void loop()
{
for(a=3;a<=12;a++)
{
digitalWrite(a, HIGH);
delay(50);
digitalWrite(a, LOW);
delay(50);
}
// Forward flow
for(b=12;b>=3;b--)
{
digitalWrite(b, HIGH);
delay(50);
digitalWrite(b, LOW);
delay(50);
}//Reverse flow
}

Physical display


Arduino Flowing Light
http://example.com/2023/10/26/FlowingLight/
Author
Chenye Meng
Posted on
October 26, 2023
Licensed under