Brain DeCoded with CodeX - Mission 2, Objective 3: Code a Neuron
Code a Neuron
Students build a working neuron in code, with the CodeX standing in for the dendrites, soma, and axon they have been studying.
Overview
Students have read about the neuron and stood in a human chain acting like one. Now they code it. The program neuron_sim maps each part of the neuron onto the CodeX, so the parts students already know get a physical home: something to receive the signal, something to process it, and something to respond.
The one setup step to watch for is the custom module. The program imports functions from a separate file, and that file has to be opened and run once so it loads onto the CodeX. After that it stays on the device, and students never have to think about it again. Students who skip that step get import errors, so it is worth doing as a class.
🎯 Project Goal: Students add code to a program that simulates a neuron.
Learning Targets
- I can write a program that models a neuron.
- I can explain the phases of the program and each part of the neuron it represents.
Key Concepts
- The text reviews the parts of a neuron while explaining how it will be represented with the CodeX device.
- The CodeX program uses a custom module, which is a file students need to open and run first. This loads the file onto the CodeX. Once it is there, it will stay there and doesn't need to be loaded again.
Assessment Opportunities
- Turn in the Activity Guide.
- Complete the program neuron_sim.
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 or pair
- ▸Laptop/computer with Chrome browser
Extensions & Cross-Curricular
randint range in send_signal(), any value added to or subtracted from strength, and the value added to start_time.
🔢
Vocabulary
▾
🐍
New Python Code
▾
processing()
responding()Function call
📐
Standards
▾
Computer Science
- Decide how students get the Activity Guide. You can print a copy for each student or assign it digitally.
- Run the program yourself first, including the custom module step, so you know what a working neuron_sim looks and sounds like on the CodeX.
- Read the Hints in the objective. They carry extra detail on neurons and custom modules that is worth reviewing with the class.
- Have CodeX devices and cables ready, and plan for the wider time range. This objective can run 45 minutes or closer to 70 depending on how much coding experience your students have.
- The Objective has an Activity Guide for students. You can print the guide for each student or assign it digitally.
- The Hints give additional information about neurons and custom modules. You may want to emphasize this or review with the students.
- The custom module file must be opened and run once before the main program will work. It then stays on the CodeX. Most errors in this objective trace back to that step being skipped.
- 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
Connect the unplugged chain to the device on the desk.
- Ask: "In our simulation, you were the neuron. If the CodeX had to play your part, what would it use to receive a signal, and what would it use to respond?"
- Ask: "When you import something in Python, where does that code actually live?"
Review the model, then get the custom module loaded before anyone starts coding.
- Students read the objective text, which reviews the parts of a neuron and shows how each one is represented on the CodeX.
- Introduce the custom module. Explain that the file holds Python code the program needs, and that opening and running it once copies it onto the CodeX.
- As a class, open and run the module file. Confirm every student got it onto their device before moving on.
- Hand out or assign the Activity Guide and point students at the CodeTrek steps.
Students build out neuron_sim and fill in the Activity Guide as they go.
- Students work through the CodeTrek steps, adding code to neuron_sim.
-
Students call
send_signal(),processing(), andresponding(), and usebreakto exit the loop and stop the program. - Students run the program, confirm it works without errors, and complete the Activity Guide.
- Fast finishers move to the extension and start adjusting values in the code.
Close on the mapping between code and biology.
- Quick share: walk through the phases of neuron_sim and name the neuron part each one represents.
- Ask: "What did the custom module save you from having to write yourself?"
- Collect the Activity Guides.