Getting to know Arduino Uno

Steps done: 0 of 5

UNOATMEGA328P-PU

Guess the answer and press Run

L, D13LOWtime, s0.0

Lesson steps

What will the L LED do?

Read the sketch and pick an answer before you run it.

What will the L LED do after you run it?

Sketch

blink_l.inoTo board
// The L LED on the board is wired to pin D13

int onMs = 1000;   // on time, ms
int offMs = 1000;  // off time, ms

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  Serial.println("L горит");
  delay(onMs);
  digitalWrite(LED_BUILTIN, LOW);
  Serial.println("L погас");
  delay(offMs);
}

Tap a line or an orange number

Serial monitor

Serial, 9600 baudboard time 0.0 s

About the lesson

The Uno R3 board on a scene with labelled parts. The sketch blinks the L LED on the board and runs in an ATmega328P emulator on this page. About 8 minutes, no sign-up. Five steps: guess, run, read the code, change the numbers and do a task with a check.

Build it for real

Parts

  • Arduino Uno R3 or a compatible board
  • USB-B cable for the board

No wires needed: the L LED is already on the board and connected to pin 13. The board is powered over USB.

The sketch below goes to the board with the default numbers: onMs 1000, offMs 1000. The numbers you changed in the lesson are passed to the flasher by the To the board link above the code.

Flash it to your own board

The whole sketch

// The L LED on the board is wired to pin D13

int onMs = 1000;   // on time, ms
int offMs = 1000;  // off time, ms

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  Serial.println("L горит");
  delay(onMs);
  digitalWrite(LED_BUILTIN, LOW);
  Serial.println("L погас");
  delay(offMs);
}

What to keep in mind on a real board

On many Uno clones the L LED sits in the same place but may be a different color. The pin is the same, 13.

Open the serial monitor in the Arduino IDE at 9600 baud, like in Serial.begin().

The sketch takes 2104 bytes of flash and 218 bytes of RAM.

Licenses of the lesson code

The avr8js 0.21.1 emulator, © 2019-2025 Uri Shaked, MIT license. The CodeMirror 6 editor, © Marijn Haverbeke and contributors, MIT license. The three.js scene, © three.js authors, MIT license.

The lesson firmware is built with the Arduino AVR core (LGPL 2.1), sources: ArduinoCore-avr. The lesson sketch and scene are made for this site.

MIT license text: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.