Hero background

Flashlight App Build

STEM • 45 • 25 students • Created with AI following Aligned with Common Core State Standards

Download now

Free PDF · we'll email you a copy

STEM
45
25 students
25 May 2026

Teaching Instructions

This is lesson 11 of 20 in the unit "Microbit Mini-Unit for Year 6". Lesson Title: Building the Flashlight App Lesson Description: Students create a flashlight app program using loops and conditionals. Success Criteria: The flashlight app can turn on/off with button presses. Extension: Add a strobe effect.

Overview

Students build a simple “flashlight” app that turns a light on or off using button presses, using loops and conditionals. This lesson is the programming bridge to real-world meanings of 0 and opposite states (on/off) as quantities with opposite directions/values, connecting to grade-level Number System ideas about positive/negative and interpreting 0.

Learning intentions

  • Students will be able to use conditionals to control program output based on button input.
  • Students will be able to use loops to continuously check for input.
  • Students will be able to explain what the “off” state means (the value/quantity 0) in the context of their app.
  • Students will be able to test and debug their flashlight app to meet the on/off success criteria.

Success criteria

  • I can press Button A and the flashlight turns on (consistent, observable output).
  • I can press Button B and the flashlight turns off (consistent, observable output).
  • I can describe how my program’s “off” state corresponds to 0 in the app context.
  • I can explain how my loop allows the app to keep responding to presses.

Curriculum links

  • The Number System: use positive and negative numbers together to describe opposite values and explain the meaning of 0 in each situation (app “off” as 0).
  • The Number System: use ordered pairs and signs to represent opposite locations (as a quick analogy for “opposite states” on a simple coordinate sketch).
  • The Number System: interpret inequalities on a number line (quick transition for “if/else” as “greater than”/“less than” logic).

Lesson structure (45 minutes)

  1. 0–5 min · Hook & demo
  • Teacher shows a quick demo of an on/off flashlight behavior and asks, “What does ‘off’ mean in numbers or quantity—what value is it?”
  • Students do a quick think-pair-share: “If on is one quantity, what is off? What is 0 here?”
  1. 5–12 min · Mini direct teach (loops + conditionals)
  • Teacher models pseudo-code on the board: a loop that repeatedly checks button states, with conditionals that set the display/output state to ON or OFF.
  • Students copy the structure into notebooks as a fill-in template: “Repeat forever → if Button A → ON, else if Button B → OFF.”
  1. 12–22 min · Guided build (starter code)
  • Teacher hands out starter blocks/code and walks through two core parts: (1) the loop, (2) the if/else logic tied to buttons.
  • Students implement Button A = ON and Button B = OFF, then run/test immediately after completing each part.
  1. 22–30 min · Debugging sprint
  • Teacher sets a 6-minute timer and circulates with a quick troubleshooting checklist: “Does the loop run? Does the conditional match the correct button? Is OFF exactly OFF?”
  • Students work in pairs to run a test script: press A (confirm ON), press B (confirm OFF), repeat 2–3 times to ensure reliability.
  1. 30–38 min · Math connection check (meaning of 0 & opposite)
  • Teacher draws a simple “number line” labeled with off/on states and asks students to articulate what “0” represents when the flashlight is off.
  • Students write a 2–3 sentence explanation: “In my flashlight app, OFF corresponds to 0 because… ON corresponds to…”
  1. 38–44 min · Quick share-out
  • Teacher selects 3–4 students/pairs to share how they implemented the loop and what rule changed the output when buttons were pressed.
  • Students observe and note one improvement idea to try (one thing another team did well).
  1. 44–45 min · Exit ticket
  • Teacher collects a short exit ticket with two prompts: (1) “Circle the correct statement: My loop keeps checking input because…” (2) “In my app, OFF equals ____ because…”
  • Students submit independently.

Resources

  • Microbit-compatible environment (or class coding platform) with block/code starter project
  • Button input documentation sheet (no hyperlinks)
  • Student notebook pages: loop/conditional template and 0-meaning explanation prompt
  • Projector/board for pseudo-code and simple number line sketch
  • Pair debugging checklist (loop running, correct button mapping, OFF truly OFF)
  • Headphones (optional) for focused build time

Assessment

  • During guided build: teacher checks that students can set ON for Button A and OFF for Button B (verbal check + quick scan).
  • During debugging sprint: observe partner testing and whether students use the checklist to locate errors.
  • Exit ticket: verify conceptual understanding that “off” corresponds to 0 in the app context and that students can describe loop purpose.

Differentiation

  • Support: provide sentence starters for the exit ticket (“OFF corresponds to 0 because…”), and a partially completed code template focusing on only the if/else blocks.
  • Support for debugging: offer “button mapping” reference cards showing which block corresponds to which button.
  • Extension (light, optional if students finish early): ask students to add a second toggle behavior using a single button (e.g., if currently OFF then turn ON; else turn OFF) using conditionals.
  • EAL/SEN: allow students to explain the meaning of 0 orally to the teacher or with a simple diagram (OFF = 0, ON = nonzero) before writing.

Extension (optional)

  • Strobe effect challenge (if time remains or during next block): students add a short rapid on/off toggle using a loop to create a strobe pattern while a button is held or pressed.

Create Your Own AI Lesson Plan

Join thousands of teachers using Kuraplan AI to create personalized lesson plans that align with Aligned with Common Core State Standards in minutes, not hours.

AI-powered lesson creation
Curriculum-aligned content
Ready in minutes

Created with Kuraplan AI

Generated using openai/gpt-5.4-nano

🌟 Trusted by 1000+ Schools

Join educators across United States