
Lighting a single led with Arduino
Arduino Uno is a microcontroller board with 13 digital output pins and 6 analog input pins. 13 digital pins can also be used for input. Some output pins can also be used as analog outputs.
To use it for digital output means to send "0" or "1" information to the output pin. Using it for analog output means sending a PWM signal to the output.
In this Arduino application, we will use digital output pin 13.
Below are the codes we wrote in the Arduino IDE environment.
In the void Setup {} section, we set pin 13 as output.
In the void loop{} block, we send “1” to pin 13 with the digitalWrite command. We provide 100 milliseconds wait with the "delay" command. Then we send “0” again with digitalWrite.
Thus, the led blinks in the "loop" block.
void setup()
{
pinMode(13, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH);
delay(100); // Wait for 100 millisecond(s)
digitalWrite(13, LOW);
delay(100); // Wait for 100 millisecond(s)
}
milivolt Youtube