Arduino Tutorial – LED Blink / Code Included

Arduino Tutorial - LED Blink Code Included

In this project we are going to repeat what we did in setting up and testing the Arduino,
which is to blink an LED. However, this time we are going to use one of the LED’s in the kit and
you will also learn about some electronics and coding in C along the way.

What you will need

Breadboard
Red LED
220 Ω Resistor
Jumper Wires

Connect it up

Now, first, make sure that your Arduino is powered off. You can do this either by
unplugging the USB cable or by taking out the Power Selector Jumper on the Arduino
board. Then connect everything up like this :

On design I’m using tinkercad.com it help me a lot design prototype and Realtime Simulation

Arduino LED Blink
Arduino Tutorial – LED Blink

Testing with simulation:

So let’s take a look at the code for this project. Our first line is
// Project 1 – LED Flasher
This is simply a comment in your code and is ignored by the compiler (the part of the
IDE that turns your code into instructions the Arduino can understand before uploading it).
Any text entered behind a // command will be ignored by the compiler and is simply there
for you, or anyone else that reads your code. Comments are essential in your code to help
you understand what is going on and how your code works. Comments can also be put
after commands as in the next line of the program.

Later on as your projects get more complex and your code expands into hundreds or
maybe thousands of lines, comments will be vital in making it easy for you to see how it
works. You may come up with an amazing piece of code, but if you go back and look at
that code days, weeks or months alter, you may forget how it all works. Comments will
help you understand it easily. Also, if your code is meant to be seen by other people (and
as the whole ethos of the Arduino, and indeed the whole Open Source community is to
share code and schematics. We hope when you start making your own cool stuff with the
Arduino you will be willing to share it with the world) then comments will enable that
person to understand what is going on in your code.

Link to code: https://github.com/hoilett/Arduino-Blink-YouTube-Tutorial

Useful link : https://www.arduino.cc/en/tutorial/blink

more example

hulviseth

hulviseth

Leave a Replay

About Me

Imtalking’s electronics projects section houses all the projects submitted by Makers for Makers. Learn how to build smart home hacks, robots, or even moisture sensor detectors for your garden.

Recent Posts

Sponsor