Blink LED pattern using Arduino on Tinkercad
Objectives :
1. To learn basic concepts of current flow.
2. To learn working of LED and Arduino
Requirements:
Name |
Quantity |
Component
in Tinkercad |
Arduino UNO |
1 |
Arduino Uno R3 |
Breadboard |
1 |
Small Breadboard |
Resistor |
3 |
1 kΩ Resistor |
LED |
1 |
Red LED |
LED |
1 |
Green LED |
LED |
1 |
Blue LED |
LED(RED) |
Arduino Uno |
Anode (+ve end of LED) |
PIN
No |
Cathode (-ve end of LED) |
GND |
LED(GREEN) |
Arduino Uno |
Anode (+ve end of LED) |
PIN
No |
Cathode (-ve end of LED) |
GND |
LED(BLUE) |
Arduino Uno |
Anode (+ve end of LED) |
PIN
No |
Cathode (-ve end of LED) |
GND |
Circuit
Diagram: Connect the components as given in the
circuit diagram below.
1. Arrange
blocks in a block editor like below (follow same order).
Explanation:
- LEDs will blink continuously by taking a pause of 1 second.
- Functions used in program are as below:
a.
Void setup() :- The Arduino program calls the setup function as the first
thing when the Arduino unit powers up. So any code that you place in the setup
function in your sketch runs first, and it only runs once. The setup function
is a great place to initialize input and output pins so they are ready to be
used.
b.
pinMode() :- pinMode() function Set the mode of
an individual pin. It accepts two arguments: Pin Number , Type of
pin(output/input)
c.
loop() :- Like all other functions, loop() is
a function. Its call only results in the execution of the code it contains; it
has no effect on the looping behavior of the code from which it is called.
d.
DigitalWrite() :- DigitalWrite will set the output to
one of two states , LOW or HIGH. It can be used to turn on a LED, switch a
relay etc.
e.
delay() :- The delay() function allows you to
pause the execution of your Arduino program for a specified period.
Output: After running the
program, we will get the below output
Comments
Post a Comment