LED Program with pattern in IoT Complete Code

IoT Program

Write a program to run a pattern on LEDs connected at pins 10, 11, 12, and 13.

The Arduino program in IoT that sequentially controls four LEDs connected to pins 10, 11, 12, and 13, displaying the specified pattern:
on, off, off, off
off, on, off, off
off, off, on, off
off, off, off, on
on, on, off, off
off, on, on, off
off, off, on, off

Initial Comments

//LED connected at pin 10, 11, 12, 13
This is a comment.
It tells us that four LEDs are connected to digital pins 10, 11, 12, and 13 on the Arduino board.

Setup Function

The setup()function runs once when the Arduino starts.
pinMode(pin, OUTPUT)tells the Arduino that these pins will be used to send signals to LEDs, not read input.
So, pins 10, 11, 12, and 13 are configured as outputs.

5 LEDs Program in IoT

Loop Function

LED 10 is ON; the others are OFF.
Waits 1 second.

LED 11 is ON; the others are OFF.
Waits 1 second.

LED 13 is ON; the others are OFF.
Waits 1 second.

LEDs 10 and 11 are ON; the others are OFF.
Waits 1 second.

LEDs 11 and 12 are ON; the others are OFF.
Waits 1 second.

This pattern is repeated from the previous one, so there’s no visible change.
Waits 1 second.

Then the loop starts over again, repeating these LED patterns every 6 seconds.

CODE
OUTPUT
IoT Program
Share your love
Jaz Expert
Jaz Expert
Articles: 12

Leave a Reply

Your email address will not be published. Required fields are marked *