Store

Please sign in to compare products.

Teacher guide Researching & planning ≈ 110 min

Lesson 2 · Weeks 1–2

First code — Blink, the IDE & binary

Learning intention

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.

Success criteria

  • I can upload _01_Blink.ino and explain what each line does.
  • I can write pseudocode for the Blink program in plain English.
  • I can modify the sketch to change the on-time, change the off-time and run two LEDs in patterns.
  • I can identify and fix at least one syntax error in my own code.

Before class

  • Open the Blink sketch at /code/<short-id> and add it to your bookmarks bar.
  • Open the PRP 1 student page in another tab — that's what students follow today.
  • Open the slide deck: /curriculum/crack-the-code/present/2 (?notes=1 for speaker notes).
  • Plug in your demo board and verify uploading works before the bell.
  • Have a small batch of spare USB cables ready (one in six fails).

Materials

Class set of Arduino Uno + MAAS ThinkerShield + USB cable · projector showing the PRP 1 student page or the Arduino IDE · spare USB cables · pin-map reference cards (printable from the resources view).

Demo & teacher script

  1. Demo the finished product — play your prebuilt alarm project and let students hear the buzzer.
  2. Live-code Blink with the class watching: type pinMode(12, OUTPUT);, then void loop() { … }, then upload. Make the D12 LED flash.
  3. Trace one cycle out loud: "now the program sets pin 12 high; LED on; wait 1000 ms; pin 12 low; LED off; wait 1000 ms; …"
  4. Deliberately introduce a bug — delete a semicolon, hit Verify, point out the red error. Then fix it. Students will miss semicolons; this prepares them.
  5. Set them off on the PRP 1 student activity; circulate.

Activities in this lesson

PRP 1

Digital output — Blink

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

_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
}
Common errors & fixes
  • "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.

Common misconceptions & fixes

  • Forgot the semicolon — by far the most common error. The IDE underlines the next line; train students to look up one line.
  • Wrong board / wrong port in Tools — re-check every lesson.
  • Pin 12 vs pin 13 — the on-board Arduino LED is pin 13 but the ThinkerShield uses pin 13 for data-transmission indication; the sketches use pin 12 so the LED behaviour is unambiguous.
  • Camel casepinmodepinMode. Tell students "if the colour doesn't change, the spelling is wrong."
  • Missing closing brace — for every { there must be a }. Put the cursor on a brace; the IDE highlights its partner.

Evidence to collect

  • Screenshot of the working Blink upload showing "Done uploading" in the IDE (formative).
  • Annotated code — each line commented in plain English by the student (formative).
  • IPO chart for Blink in the workbook (formative).
  • Challenge completion checklist — partner/teacher signs off the four PRP 1 challenges (summative-ish).
  • Reflection response to the exit prompt (formative).

Support path

  • Provide a partially-completed Blink sketch with comments already in place — students change only the delay numbers.
  • Pair-program: one student types, the other reads the line aloud.
  • Print a labelled pin diagram of the ThinkerShield in large format.

Extension path

  • Make the LEDs chase in a back-and-forth pattern, not just one direction.
  • Use the int command to give each pin a friendly name; refactor your sketch to use those names everywhere.
  • Replace delay() with millis() so the LED can flash without freezing the program (preview of PRP 4).

Exit reflection

Write two sentences in your workbook:

  1. "The hardest part of today's PRP was ____ because ____."
  2. "Next lesson I want to try ____."
Syllabus outcomes hit by this lesson: TE4-4DP TE4-7DI TE4-DES-01 TE4-DIG-02
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.