2. 2
Turn on the LED - Overview
Let’s 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
Let’s 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