F-4 microbits
F-4 microbit magic 8 ball
In this lesson, students will create a magic 8 ball fortune-teller, using a BBC microbit and craft material.
OBJECTIVES: By the end of this lesson, students will:
Identify the "random" function
Recognize the "on shake" command.
use the If-Else statement.
create a magic 8 ball fortune-teller.
TEACHER RESOURCES
Student Page Magic 8 ball: Student Handout
SparkFun: Magic8Ball Video ( 7 minutes)
Craft material:
Small container: yogurt carton / paper box. Tape. Color / wax paper.
Do Now (5 minutes)
A history of the Magic 8 Ball (2:11)
TEACHER GUIDANCE:
Mini-Lesson (5 minute Demo)
Context building:
Show students a magic 8 ball and a pre-made microbit magic 8 ball. Have the class ask it three random questions.
What pseudocode would be required for a magic 8 ball?
Show default picture at start, such as a heart LED
Randomly pick True of False
If True show Checkmark else show a X
Two concepts are introduced in this lesson: If-Else and Random.
Discuss what the word Random means. If the class is not familiar with the If structure, play a round or two of backyard conditionals.
Demonstrate software using student handout and microbit. Show students how to create a If-Else from a If command - shown on handout.
Students build magic 8 ball. (with team partner)
Build software using microbit and student handout.
Build hardware using craft material. Small boxes or cartons work well for a body. Sticky eyes. Color paper. Pipe-cleaners.
Test on partner and iterate.
Extension day:
A similar project that could develop from this project is Rock Paper Sissors commonly called RoShamBo which uses a variable, to store three possible outcomes.
Close-Out (5 minutes)
Discuss the following questions:
How does the traditional magic 8 ball work? (It uses a 21 sided die, floating in liquid. When you turn the ball over, the die face can change.
How does the micro:bit 8 ball work?
It works using code. When you shake the micro:bit, it randomly generates a 1 or 0 which corresponds to either a checkmark or a cross.
Could we made the micro:bit magic 8 ball have 21 responses?
Yes it would just take a lot more coding.
Details: You would need to use a variable or list to store shake outcome (1-21) and then access the response associated with that number.
Standards CSTA
CSTA 2-CS-03 : Systematically identify and fix problems with computing devices and their components.
CSTA 2-AP-11 Design and iteratively develop programs that combine control structures, including nested loops and compound conditionals.