This Arduino tutorial teaches how to turn an LED on and off by writing simple code. It explains that the built-in LED is internally connected to digital pin 13, and shows the code to set pin 13 as an output and write either a HIGH or LOW value to turn the LED on or off, respectively. The result is demonstrated of the LED turning on when writing HIGH and off when writing LOW.
2. 2
Turn on the LED - Overview
Lets turn on the LED
Simple code
Turn on the built-in LED
Built-in LED for test
Internally connected to digital pin #13
Source: pixabay.com/photo-2168193
3. 3
Turn on the LED - Sketch
setup() { }
pinMode(13, OUTPUT);
Prepare the mode of pin
We will use pin #13
We will order to LED OUTPUT
loop() { }
digitalWrite(13, HIGH);
Write digital value to the board
We will use pin #13
Turn on == HIGH
4. 4
Turn on the LED - Result
Built-in LED is turned on!
LED ON
Source: pixabay.com/photo-2168193
5. 5
Turn off the LED - Overview
Lets turn off the LED
Simple code
Turn off the built-in LED
Source: pixabay.com/photo-2168193
6. 6
Turn off the LED - Sketch
setup() { }
pinMode(13, OUTPUT);
Prepare the mode of pin
We will use pin #13
We will order to LED OUTPUT
loop() { }
digitalWrite(13, LOW);
Write digital value to the board
We will use pin #13
Turn off == LOW
7. 7
Turn off the LED - Result
Built-in LED is turned off!
LED OFF
Source: pixabay.com/photo-2168193