Hero background

Tracking Variables

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 2 of 15 in the unit "Micro:bit Innovations". Lesson Title: Variables and Data: Storing Information on Your Micro:bit Lesson Description: Students dive deeper into variables as a core computer science concept, learning how to store, update, and display data using MakeCode. Building beyond basic 6th grade programming, students create a step counter or reaction timer to see variables in action. Differentiated challenges allow beginners to use guided templates while advanced learners build custom variable-driven programs. MakeCode project: Personal Reaction Timer using variables and the 'running time' block.

Overview

In this lesson (lesson 2 of 15) of “Micro:bit Innovations,” students expand their understanding of variables by using MakeCode to store, update, and display data. They create a step counter or reaction timer so they can see how numbers change over time.

Learning intentions

  • Students will understand that variables hold information that can change during a program.
  • Students will be able to create and update a numeric variable using user actions or time.
  • Students will be able to display the value of a variable on the micro:bit screen.
  • Students will be able to interpret a program’s output as a meaningful measurement (count or elapsed time).

Success criteria

  • I can create a variable in MakeCode and set it to an initial value.
  • I can update the variable using an event (button press) or time (running time).
  • I can show the variable value using an appropriate display block.
  • I can explain what my variable represents in my timer or step counter.

Curriculum links

  • Number System — addition/subtraction reasoning: adding/subtracting rational numbers and representing change on a number line.
  • Number System — division and sign rules (CCSS.MATH.CONTENT.7.NS.A.2b): interpreting quotients as rational numbers, relevant when converting or scaling time.
  • Number System — multiplication and signed numbers (CCSS.MATH.CONTENT.7.NS.A.2a): interpreting products in real-world measurement contexts.
  • Number System — additive inverses (CCSS.MATH.CONTENT.7.NS.A.1b): recognizing “change back to zero,” which matches reset behaviors in programs.

Lesson structure (45 minutes)

  1. 0–5 min · Hook: “What changed?”
  • Teacher shows two quick MakeCode-style outputs (one counts up, one resets and starts over) and asks: “What information is being saved, and how do you know it changed?”
  • Students do a quick think-pair-share, naming what “memory” the program must be using (a stored value).
  1. 5–12 min · Direct teach: Variables as memory
  • Teacher introduces variables as “named storage” and demonstrates with a simple block flow: set variable → change variable → show variable.
  • Students mirror on scratch paper: they write “Variable name = what it measures” and circle the value that updates.
  1. 12–20 min · Mini-demo: Reaction timer with running time
  • Teacher builds the Personal Reaction Timer concept: start on button press, read elapsed time using the running time block, store it in a variable, and display it.
  • Students complete a guided checklist: identify (a) where the variable is set, (b) where it is updated, (c) where it is displayed.
  1. 20–34 min · Guided build (beginners) + choice path (advanced)
  • Teacher groups students by readiness: beginners use a provided template; advanced learners build from a partially completed project.
  • Students code their program using one of two goals:
  • Reaction timer: store elapsed time in a variable, display it after the second button press.
  • Step counter: increment a variable each time a motion/step event occurs, and display the count.
  • Teacher circulates with two prompts: “What exactly does your variable mean in the real world?” and “What operation are you using to update it (add, subtract, reset)?”
  1. 34–41 min · Share-out: Reading and interpreting results
  • Teacher asks volunteers to run their program and explain what the number on the screen represents.
  • Students compare one peer’s program output to their own, using sentence frames: “My variable is measuring… When I press… the variable changes by…”
  1. 41–45 min · Exit ticket: Variable meaning + update rule
  • Teacher collects a quick response: students answer two questions on paper or in a Google Form (no hyperlinks): (1) Define your variable in one sentence, (2) Write the update rule you used (example: “timeElapsed = runningTime − startTime” or “steps = steps + 1”).
  • Students submit before leaving.

Resources

  • micro:bit devices (1 per student or pairs)
  • MakeCode access (school accounts)
  • Printed or on-screen template for reaction timer (for beginners)
  • Partially completed project starter (for advanced learners)
  • Coding checklist handout (set, update, display)
  • Exit ticket slips
  • Timer or slide counter demo cards (teacher-made visuals)

Assessment

  • Teacher observation during coding: “Where is your variable set? Where is it updated? Where is it displayed?”
  • Formative check during share-out: students correctly interpret the variable in a real-world way.
  • Exit ticket: clarity of variable meaning and correctness of the update rule.

Differentiation

  • Support for beginners:
  • Provide a template with variable names pre-inserted.
  • Give sentence starters for explanations (“My variable stores…”).
  • Offer a “debug menu” list: check button order, check reset, confirm display block.
  • Support for EAL/SEN:
  • Use visual labels: SET (start), UPDATE (change), SHOW (display).
  • Allow responses as sentence frames or drawing + one word.
  • Extension for advanced learners:
  • Add a “best time” variable or “lowest steps” tracker and explain how it uses comparison.
  • Introduce scaling (e.g., convert milliseconds to seconds) and justify the arithmetic using rational-number reasoning language (divide by 1000; interpret quotient as a measurement).
  • Manage group pace:
  • Pair students who finish early with those still building, focusing on explanations rather than copying code.

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