Hello readers!!!
Yes you are here because you’ve chosen this techiehunters’ posts and clicked on Arduino LED blinking project. So let’s collect the important components list. We will need an IDE for coding on Arduino. You will get the IDE from this site. First download the installer then install the software. Remember don’t plugin the Arduino while installing this software. if you have done the installation of the software then come to the components.
Components List:
1. Arduino —- 1pc
2. LED —- 1pc
3. Jump Wire (male to female) —- 2pcs
First of all connect the LED with Arduino. Connect the Arduino pin 13 with LED positive pin and GND with LED negative pin. Thenconnect the Arduino with computer. Now open the software and write the code below:
void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW) delay(1000); // wait for a second }
If you don’t want to write the code then you can just load it from the examples given with the IDE. Just go to File–> Examples –> Basic –> Blink. Your desired code will be loaded. Now just upload the code to the Arduino then see the magic….!!!!!
What are you seeing???
Yeah…… It’s blinking with intervals of one second.
Now come to the code. We have accessed the 13 Number Pin of Arduino by defining LED_BUILTIN in the pinMode() as OUTPUT in the setup block. If we want to access another pin to blink the LED then we will have to define it first. We will talk about it later here.
Come to the loop block. This block is in the infinite loop that will continuously be running while the Arduino’s power is on. In the loop block we have wrote four lines of codes. The first line of this loop block says,
digitalWrite(LED_BUILTIN, HIGH)
that means, give the LED_BUILTIN pin the digitally high voltage means 5 volts which means turn the LED on. Then second line says,
delay(1000)
This line says the Arduino to wait for 1000 milliseconds. Then the next two line again
digitalWrite(LED_BUILTIN, LOW)
delay(1000)
that means, Turn the LED off and wait for 1000 milliseconds. Here you have accessed only 13 number pin for LED if you are told to access 12 or 10 then what would you do? Don’t worry, this is so easy to access the Digital ports of Arduino. Just define at the beginning of the code as below
int LEDpin11 = 11;
This means, accessing the 11 number pin as LEDpin11.
Exercise:
Try to blink 3 LEDs one after another with half second of intervals.
I wish you understood my first program on Arduino. Keep eye on this site for more tutorials based on Arduino, Robotics and Electronics. If you’ve found this post important or helpful then please share this post among your friends and circles. Keep in mind sharing is caring.
Have a nice journey………