Brain DeCoded with CodeX - Mission 3, Objective 3: Your Brain on Sunshine
Your Brain on Sunshine
Students code a simulation that uses the CodeX light sensor to model what sunshine and time in nature do to the brain, using flashlights and their own hands to change the light.
Overview
Objective 2 simulated a full day of activities. This one zooms in on a single variable, light. Students build sunshine, a program that reads the CodeX's built-in light sensor and models what more sun, and less of it, does to brain function.
The input is physical. Students shine a flashlight on the sensor to add light and cover it with a hand to take it away, so the numbers on screen respond to something they are doing in the room. Six events are listed on the Activity Guide, and students can run them in any order and as many times as they want.
The code introduces a small set of built-in math functions, abs(), int(), and min(), each doing a specific job with the sensor reading.
🎯 Project Goal: Students add code to a program that simulates the effects sunshine and nature have on the brain.
Learning Targets
- I can explain how sunshine and being in nature affect brain function.
- I can code and run a sunshine and nature walk simulation.
- I can observe and record the results of sunshine and nature walks on brain function.
Key Concepts
- Increased sunshine and nature walks have a positive effect on brain function.
- Lack of sun can negatively affect brain function.
- Students use a flashlight, or another light source, to simulate sunshine.
Assessment Opportunities
- Turn in the Activity Guide.
- Complete the program sunshine.
Success Criteria
- Complete the CodeTrek steps
- Program runs correctly without errors
- Activity Guide is completed
Digital Resources
Classroom Materials
- ▸CodeX device and USB cable, one per student
- ▸Laptop/computer with Chrome browser
- ▸Flashlights, or another light source. A phone flashlight works.
Extensions & Cross-Curricular
sun_interval(), or modify the code in sunlight().
abs(), int(), and min(). Discuss these functions, their differences, and when each one would be used.
adjust_levels() function. Recreate it on paper and go through the calculations with data.
🐍
New Python Code
▾
abs() function returns the absolute value of the argument. It can be used to detect a change, either positive or negative.
int() function returns the value of the calculation as an integer.
min() function returns the smaller value
📐
Standards
▾
Physical Science
- Run sunshine yourself first, and try the flashlight and hand-cover inputs so you know what range of readings your room produces.
- Gather light sources. Flashlights work, and so do phone flashlights if your school allows them. You do not need one per student, groups can share.
- Decide how students get the Activity Guide. You can print a copy for each student or assign it digitally. Students record their six events on it, so they need it before they start.
- Check the lighting in your room. A classroom right next to a bank of windows behaves differently from one with the blinds down, and that baseline affects every reading.
- Read the Hints in the objective. They carry extra information about sunlight that is worth reviewing with students.
- The Hints include additional information about sunlight. You can review them with students.
- The simulation uses the CodeX light sensor. It is built in, so students do not need to do anything extra to connect it. The amount of light shining on the light sensor is returned as a value.
- Students can use flashlights to add light, and cover the sensor with their hands to remove light.
- Students should follow the instructions on the Activity Guide to conduct the simulation. Six events are listed. They can be done in any order and repeated as often as students want.
- Students can repeat the simulation by starting it over, like going to a new day.
- Extensions and cross-curricular projects are included to enhance the concepts in the objective. You can use the extensions to extend students' learning.
Lesson Outline
Start with something students have felt themselves.
- Ask: "How do you feel after a week of gray, rainy days compared to a bright one? Is that real, or is it in your head?"
- Ask: "If we wanted to measure sunshine with the CodeX, what would we need it to sense?"
Students add code to sunshine.
- Students work through the CodeTrek steps, adding code to sunshine.
-
Stop on the math functions as they appear.
abs()detects a change in either direction,int()drops the decimal, andmin()caps a value. - Review the Hints on sunlight with students at whatever point fits your pacing.
- Confirm the program runs without errors before students start collecting data.
Students run the six events and record results on the Activity Guide.
- Students work through the six events, in any order they like.
- Flashlight on the sensor adds light. A hand over the sensor takes it away.
- Events can be repeated as often as students want, and the simulation can be restarted for a fresh day.
- Students record what each event does to the levels.
Bring it back to the brain.
- Compare results across the room. Which events had the biggest effect?
- Ask: "What does this simulation say about someone who spends the whole day indoors?"
- Ask: "The sensor measures light. What does sunshine do for the brain that a flashlight does not?"
- Collect the Activity Guides.