ABC of Electronics cosycom.com
ARDUINO 04 · Getting Started

Your First Sketch: Blink an LED

Write and upload your very first program from scratch — three lines of setup, three lines of loop, one blinking LED.

You'll need: just the Arduino Uno board and a USB cable — the board's built-in "L" LED (wired to pin 13) means no external components are required for this first sketch.

Rather than opening the pre-made example, type this out yourself — typing code by hand, even simple code, builds far more familiarity than clicking through a menu:

void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);
}

Reading it against Lesson 3's skeleton: setup() runs pinMode(13, OUTPUT) once, telling the board that pin 13 will be used to send a signal out, rather than read one in. Then loop() repeats forever: turn pin 13 HIGH, wait 1000 milliseconds (one second, via delay()), turn it LOW, wait another second, and repeat.

Click Upload. After a few seconds of compiling and transferring, the onboard LED marked "L" should start blinking on and off, once per second — the same pattern you just wrote.

Once it's working, try changing the two 1000 values to 200 and re-uploading — a small, safe change that confirms you understand which numbers control the timing before moving on to wiring anything external.

UNO L abcofelectronics
Pin 13's built-in LED No wiring needed for this first sketch — pin 13 already connects to a small LED right on the board itself.
TRY THIS
Type the code yourself rather than pasting a premade example — the small act of typing pinMode, digitalWrite, and delay by hand is what makes them stick.