Store
Your lesson ≈ 110 min

Lesson 2 · Weeks 1–2

First code — Blink, the IDE & binary

What you'll learn

Write, upload and modify your first Arduino sketch — make the on-board LED blink, explain each line, and modify it to meet a series of challenges.

What you're doing today

  • Load and run Blink; use the word bank to label the parts of the sketch and record what each command does.
  • Complete the Arduino language and binary cloze passages.
  • Write pseudocode for blinking the classroom lights, then for the Blink sketch; draw the flowchart for Blink; answer the "making connections" questions.
  • Complete PRP #01 (Blink): the IPO chart, then the challenges (change the on-time; change the off-time; two LEDs flashing together; LEDs "chasing" from D12→D9; your own pattern); complete the self-reflection.
  • Experiment with the int command; sketch branching diagrams for a child's night light and a Mortein-style timer; write a short binary message using an online translator.
PRP 1

Digital output — Blink

Upload the _01_Blink.ino sketch and watch the D12 LED flash on for a second, off for a second, forever. Then go deeper into the sketch:

  1. Pseudocode it. In plain English, how would you make the classroom lights blink on and off every ten seconds? (Turn the switch on → wait → turn it off → wait → repeat.) Now write the pseudocode for the Blink sketch itself.
  2. Make connections. Re-open _01_Blink.ino and compare your pseudocode to the real code — same order? Similar steps? Different language?
  3. Understand the code. Work out what each line means: pinMode(12, OUTPUT) makes pin 12 send current out (to the LED); void loop() { starts the forever-loop; digitalWrite(12, HIGH) turns pin 12 on; delay(1000) waits 1000 milliseconds (1 second); digitalWrite(12, LOW) turns it off.
  4. Label the IDE. Use the word bank to label the sketch title, status bar, upload & verify buttons, Serial Monitor, comments, curly braces, the semicolon, void setup, the debug area.
  5. Flowchart it. Draw the flowchart for Blink (terminator → process → delay → …).
  6. Challenges. Then modify the sketch:
    • change how long the LED is on for;
    • change how long the LED is off for;
    • make two LEDs flash on and off together (e.g. D12 and D8);
    • make the LEDs "chase" each other from D12 down to D9;
    • make the LEDs come on in pairs or your own pattern.

Get a partner or your teacher to tick off each challenge, then complete the self-reflection.

What you'll learn

Write and modify your first Arduino program. Make the D12 LED blink and explain what every line does.

What you'll make

  • I can upload _01_Blink.ino and see the LED flashing.
  • I can write pseudocode for the Blink program in plain English.
  • I can change how long the LED is on for and how long it is off for.
  • I can make two LEDs flash in a pattern.

What you need

Arduino Uno + MAAS ThinkerShield + USB cable, a laptop with the Arduino IDE, this curriculum page open in a tab.

Sample code

_01_Blink.ino · Blink — PRP #01 (Crack the Code) ✦ English View Raw
void setup() {              // runs once when you press reset or power the board
  pinMode(12, OUTPUT);      // make digital pin 12 an output
}

void loop() {               // runs over and over again, forever
  digitalWrite(12, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for one second (1000 milliseconds)
  digitalWrite(12, LOW);    // turn the LED off (LOW)
  delay(1000);              // wait for one second
}
Quick chips

Steps

  1. Plug your Arduino into the laptop with the USB cable. The red power light on the ThinkerShield should come on. If it doesn't, try a different USB cable.
  2. Open the Arduino IDE. Go to Tools → BoardArduino Uno. Go to Tools → Port and pick the port that says usbmodem (Mac) or the COM port that appeared when you plugged in.
  3. Open the Blink sketch. From this page, click _01_Blink.ino in the Sample code list. Copy it (the Copy button at the top right of the snippet), paste it into a new Arduino IDE sketch.
  4. Verify it. Click the tick (✓) button at the top-left of the IDE. The status bar at the bottom should say "Done compiling". If it says "error", look at the red message — usually it's a missing ; at the end of a line.
  5. Upload it. Click the arrow (→) button next to the tick. The TX/RX LEDs on the board flash while it uploads; the status bar says "Done uploading".
  6. Watch the LED. Pin D12 on the ThinkerShield should be on for 1 second, off for 1 second, forever.
  7. Complete the IPO chart in your workbook.
  8. Write the pseudocode — in plain English, line by line, describe what your sketch does.
  9. Challenges — modify the sketch to:
    • change how long the LED is on for (try 3 seconds);
    • change how long the LED is off for (try ½ second);
    • make two LEDs flash on and off together (pin 8 and pin 12);
    • make the LEDs "chase" from pin 12 down to pin 9 in order;
    • make a pattern of your own with three or more LEDs.
  10. Get it signed off. Show a partner or your teacher each challenge that works.
  11. Reflect — write two sentences in your workbook (see the reflection prompt).

IPO chart

Inputs

  • None — Blink runs on a fixed timer (there is no sensor)

Processing

  • void setup() runs once: set pin 12 as an OUTPUT with pinMode(12, OUTPUT)
  • void loop() repeats forever: digitalWrite(12, HIGH) → delay(1000) → digitalWrite(12, LOW) → delay(1000)

Outputs

  • LED on the ThinkerShield, pin D12
Stuck? Common things to check Tap to open
  • "It says error so my code is broken" — usually it's one missing ; or }. Look at the line ABOVE the red one.
  • "Why isn't my LED working?" — wrong pin (sketches use 12, not 13), wrong board/port, USB cable not fully seated.
  • "It compiled but nothing happens" — did you press Upload (→), not just Verify (✓)? They're different buttons.

Take it slower

  • Don't worry about challenges 3–5 today. Get the basic Blink working and one delay change made.
  • Pair up with a classmate — one types, one reads the line aloud.
  • If you're stuck on a syntax error, ask a friend to look at the line above the red one.

Push further

  • Use the int command (see _03_int.ino) to give pin 12 a friendly name; rewrite Blink with the name.
  • Make the LEDs flash without delay() — use millis() so other things can happen at the same time.
  • Try analogWrite() on a PWM pin (3, 5, 6, 9, 10, 11) to fade the LED in and out.

Done when…

You've finished PRP 1 when all of these are true:

  • The D12 LED is flashing on your board.
  • Your IPO chart is complete in your workbook.
  • Your pseudocode is written in your workbook.
  • You've attempted at least two of the five challenges.
  • A partner or your teacher has signed off the working challenges.
  • Your reflection is written.

Reflect

Write two sentences in your workbook:

  1. "Today I learned that an Arduino sketch always has ____ and ____."
  2. "The first challenge I want to try at home is ____."
Maddy, co-founder of Little Bird

Need help? We're here for you!

Hi, I'm Maddy. My team and I are ready to help with your order or any questions.