In previous 4 lessons, you got basic idea about what is Arduino,
and how to control Arduino IDE. This is the first post we are going to teach
you how to create something using Arduino. First you need to have an Arduino board
and Arduino IDE with you. Also, the cable that gives ability to connect PC and
Arduino board. Here is the list what you need.
- x1 LED
- x1 220ohm Resistor
- x1 Arduino Board
- x1 Suitable Cable for Arduino Board
- x3 Male to Male Jumper Wires
- x1 Project board
Don’t you know how project board works? Go and see the
inside of project board by clicking below button.
Here is the circuit diagram. You have to make the circuit
according to this image.
Now let’s have a look about the code.
You have to put code like this for making the LED on.
We initialized 5th pin as an output in this Void Setup.
We are putting ‘pinMode’ for initialize a pin. So, ‘digitalWrite’ makes the output.
‘HIGH’ in the ‘digitalWrite’ function is make digital high output. In simple
words it makes current on in that pin. ‘LOW’ in the ‘digitalWrite’ function is make
digital low output. In simple words it makes current off in that pin. Remember
to put correct spellings in the correct positions, because otherwise your code
will not work properly. Now we have test Arduino LED Blink project.
You have to put initializing in the Void Setup as I mentioned
above. Then you can add high function and make a delay. Delay is always coming
with milliseconds. So, you can put 1000 milliseconds and get 1 second delay.
After putting delay, you need to put digitalWrite low function. It will off the
light. Then put 1000 millisecond delay again and make the code complete. Then
your Arduino blink project is ok. If you don’t have a LED or resistor, don’t
worry. Arduino’s 13 pin always connected with Arduino inbuilt light. So, you
can put 13th pin instead of 5th pin mentioned in those codes.
This is an advanced type of Arduino LED blink. If you like
to learn more about Arduino, here you can learn. If you want learn only basics,
you can skip this.
We are putting the pin as a variable. So, it will make
larger codes easier. If you type 5th pin, 5th pin always
at the code. There is a possibility to forgot the use of 5th pin. If
you make variable in the beginning of the code as 5th pin is defined
as LED, you only have to type ‘LED, HIGH’ in the code. Now you can understand
the value of this technique.
This is much more advanced part in Arduino LED blink. You can add number value instead of HIGH function in Arduino. In number values, you can control the brightness of the LED. Maximum number you can use for digitalWrite is 255 and lowest one is 0. You can understand much more using below code.