Control a LED - mako

Mako
Mako
nome
Go to content
Arduino > Tutorials
Turn on a LED
On Arduino there is already a soldered LED, called LED_BUILTIN, where you can do the firt experiments without buy anyadditional component.
After the upload, the green LED on the board will turn on for 1 sec (1000 milliseconds) and turn of for 1 second.
Let's try to upload the first sketch!


The sketch

void setup(){
pinMode(LED_BUILTIN, OUTPUT);
}
void loop(){
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}

Schetck analysis
void setup(): in the "void setup" you need to put everything that is not repeating. Here for more details.
pinMode(LED_BUILTIN, OUTPUT): set the mode of the device. Leds are output devices, a sensor is an input device. LED_BUILTIN set automatically the mini led (smd) on your board.
void loop(): here begins the loop, the actions here will be repeted. Here for more details.
digitalWrite(LED_BUILTIN, HIGH): say what the led should do. High means on.
delay(1000): wait 1 second (1000 milliseconds).
digitalWrite(LED_BUILTIN, LOW): say what the led should do. Low means off.
delay(1000): wait 1 second (1000 milliseconds) end of code, the loop will be restarted.


There are no reviews yet.
0
0
0
0
0
Arduino Watering System
An irrigation system based on Arduino
Published by - 24/2/2021
Arduino Robotic Arm
A Robotic Arm made by Arduino UNO, use the buttons to move the arm
Published by - 24/2/2021
Arduino Sunflower
A sunflower made by Arduino, it follows the light!
Published by - 24/2/2021
Back to content