Scrolling Name Tag – Create a Digital Name Badge
Middle / High School (Intro CS / Micro:bit)
Approximately 30–45 minutes
By the end of this lesson, students will be able to:
while True Loop: Code that repeats continuously.Ask students:
“If the micro:bit only has 5×5 LEDs, how can it show longer words like your full name?”
Guide them to the idea that only part of the word is shown at a time, and the word moves (scrolls) across the screen.
If you’re using MakeCode Blocks, have students follow these steps:
ScrollingNameTag."Hello!" to their name, for example: "JOE".Resulting logic (Blocks):
forever
show string "JOE"Discussion Prompt: How could this be useful at an event, club meeting, or competition?
If you’re using MicroPython, have students write this code:
from microbit import *
while True:
display.scroll("JOE")
Students should:
"JOE" with their own name (all caps works best)..hex file and copy it to the micro:bit.Their name will now scroll continuously.
Explain that we can slow down or speed up the text using the delay parameter (milliseconds per step).
from microbit import *
while True:
display.scroll("JOE", delay=100) # smaller = faster, larger = slower
Have students experiment with different delays:
Show how to display a simple image after the name:
from microbit import *
while True:
display.scroll("JOE", delay=120)
display.show(Image.HEART)
sleep(500)
Ask students to choose a different image, such as Image.HAPPY or Image.SAD, that matches their personality.
Pick 1–2 as time allows:
Use button A to toggle whether the name is scrolling.
from microbit import *
scrolling = True
while True:
if button_a.was_pressed():
scrolling = not scrolling
if scrolling:
display.scroll("JOE", delay=120)
else:
display.show(Image.STICK_FIGURE)
Use button B to cycle through slow, medium, and fast scrolling (teacher or students can design this feature).
Scroll "HELLO I AM JOE" as a full phrase, and discuss how spaces help readability.
Have students wear the micro:bit on a lanyard or clipped to their shirt as a “digital name badge” (battery pack required).
The name of the file will be:
PX_lastname_ScrollName
PX_lastname_ScrollName.png — Screenshot inside Python editor showing your code.PX_lastname_ScrollName.py — Your Python source file.PX_lastname_ScrollName.txt — Plain-text copy of your code.PX_lastname_ScrollName.hex — Hex file to run on the physical micro:bit.PX_lastname_ScrollName.mp4 — Short demo video of the program running on the board.Have students answer one of the following questions: