Self-check
- In this activity, you:
- Built and tested a pushbutton circuit.
- Wrote scripts that monitored the pushbutton circuit through a micro:bit I/O pin.
- Wrote scripts that performed different actions that depended on whether or not the pushbutton was pressed.
- Did you successfully build the pushbutton circuit and understand the pushbutton pin map?
- Do you understand how current flows through the pushbutton circuit?
- Were you able to monitor the on/off states of the pushbutton circuit?
- Were you able to manipulate the action of the LED given the state of the pushbutton?
Questions
- Where might you find pushbuttons?
- How are pin maps and schematics used?
- What is the allowable rotation for the pushbutton in relation to the pin map?
- What value represents the pushbutton when pressed?
- Name two circuit types that would be considered binary?
- What is the memory that stores the voltages measured by I/O pins called?
- What do you call the memory element storing binary values that indicate whether or not voltage has been applied to a pin.
Exercises
- What call disables the micro:bit’s 5 x 5 LED display grid?
- What is the function of pin6.read_digital()?
- Which method is used to dictate the state of the LED?
- How does digital_read() impact the I/O pins?
- What is the threshold for determining that voltage has been applied to a pin?
Project
Write a script to make the light blink when the button is pressed but without using an if...statement. Hint: the 1/0 value from the pushbutton state can be used to turn the light on or off, and then sleep. After that, the script just needs to make sure it turns the light off and sleeps again before repeating the while True() loop.