Blink is a very simple example of a program written using the Arduino programming language. This tutorial will show how to use the Arduino IDE to write programs that control hardware devices like LEDs and motors.
What does this mean?
A “blink” is a short period of time during which a light source (such as an LED) is turned on and off rapidly. In this case, the LED is blinking at a rate of one second per second.
The first thing we need to do is set up our pins so that we can control them with the Arduino. We will use two pins, one for power and one for ground. To do this, we must connect the +5V pin to the 5V rail and the GND pin to the GND rail. Then, we must tell the Arduino what pins to use. This is done by setting the number of pins used to 2.
- Arduino Board
- 220 ohm resistor
This example uses the built-in LED that most Arduino boards have. This LED is connected to a digital pin and its number may vary from board type to board type. To make your life easier, we have a constant that is specified in every board descriptor file. This constant is LED_BUILTIN and allows you to control the built-in LED easily. Here is the correspondence between the constant and the digital pin.
A more advanced version.
In order to make things easier, I decided to write a more advanced version of the blinking code. This version uses a loop function to keep the LED on continuously.