Lesson 5: Saving sea turtles with micro:bit
45 minutes
Overview
In today's skill-building lesson, the goal is to make a prototype of automated lighting that switches on when it gets dark. The key concepts are: loops, conditionals (if.. then.. else..), inputs and outputs.
Standards
AP - Algorithms & Programming
- 1B-AP-10 - Create programs that include sequences, events, loops, and conditionals.
CS - Computing Systems
- 1B-CS-02 - Model how computer hardware and software work together as a system to accomplish tasks.
Agenda
Objectives
Students will be able to:
- Program the input of the micro:bit to be the sensor detecting light level
- Write code that includes loops and conditionals
Preparation
-
Make sure students have completed the Meet your micro:bit exploration lesson.
-
“Make sure you know how to create a new classroom section where students will code their micro:bit project.”
-
Note: Variables are not covered explicitly in CS Fundamentals Course D, but your students may have used them as a game score counter in Course C Lesson 13: Mini-Project: Chase Game.
Links
Heads Up! Please make a copy of any documents you plan to share with students.
For the teachers
- CS talking points for code - Resource
- Grade 3 - Maker with micro:bit slides - Slides
- Live micro:bit classroom session - Resource
- Saving Sea Turtles: Finished project - Exemplar
For the students
Vocabulary
- Conditionals - Statements that only run under certain conditions.
- Loop - The action of doing something over and over again
Teaching Guide
Warm Up (10 minutes)
Warm Up
Say: Today's aim is to build a prototype of beach lighting for paths that guide humans safely but don't distract turtles by coding the micro:bit to light up the display only when it gets dark.
[Option 1] Do this: Watch the introduction video.
[Option 2] Do this: Explore the project uploaded onto micro:bits prior to the lesson.
Discuss where these concepts are being used and where students may have used them before:
- Loop: The action of doing something over and over again (e.g., the "forever" block keeps running the code to check the light level)
- Conditional: A statement that only runs under certain conditions (e.g., if the light level is below 100, show the turtle image on the LED display)
- Input: The information computers get from users, or as in this case, from a sensor (e.g., light level reading)
- Output: The information users get from computers (e.g., LED lights showing turtle image)
Do this: Share the project working in the simulator with your students and look at the code together prior to students coding the main activity.
Main Activity (30 minutes)
Student Coding
Students will make the project themselves using the MakeCode editor and micro:bit simulator. Once they have tested their code in the simulator, they will download their code onto the micro:bits.
Pick one:
- Step by step coding video
- Live micro:bit classroom session
Assessment (10 minutes)
After completing the lesson, assess students' knowledge of the concepts covered by going through the assessment slides in the slide deck. You can also assign students a content assessment hosted on the JuiceMind platform. To assign the assessment to your students, click here.
Setting up a JuiceMind assessment
Click "Assign" on the assessment page, then have students join your unique class session. Students have a link to the Join page on level 1, and will need to enter the class session code. After students complete the assessment, you can view their results on the JuiceMind teacher dashboard.
Note: You will need to sign up for an account on JuiceMind to assign the assessment.
Wrap Up (5 minutes)
Discussion
Share student work, revisit key concepts used, and explore ideas for extended learning.
[Optional] Extension
Plant Protector
Today we'll use your micro:bit to create mini weather stations, to help gardeners protect their plants. Plants thrive in specific temperature ranges. Some prefer warm, sunny spots, while others do better in cooler, shadier areas. By monitoring the air temperature with your micro:bit, you can ensure your plants are getting the right environment to flourish and keep them happy and healthy!
Find the student handout for this project here.
Note: Pages 3-5 of the student handout include step by step coding directions and are an optional support to provide students.
Find the code for this project here.
[Optional] Extended learning
Experiment with light levels: Vary the light level number to work better in your environment. Numbers higher than 100 will turn the light on even when it's brighter, numbers lower than 100 will only turn the light on when it gets darker.
Make an animation: Show an animation by making a sequence of different images - for example, a turtle walking.
Find this project and more on microbit.org
This work is available under a Creative Commons License (CC BY-NC-SA 4.0).
If you are interested in licensing Code.org materials for commercial purposes contact us.