Review and Practice

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

  1. Where might you find pushbuttons?
  2. How are pin maps and schematics used?
  3. What is the allowable rotation for the pushbutton in relation to the pin map?
  4. What value represents the pushbutton when pressed?
  5. Name two circuit types that would be considered binary?
  6. What is the memory that stores the voltages measured by I/O pins called?
  7.  What do you call the memory element storing binary values that indicate whether or not voltage has been applied to a pin.
     

Exercises

  1. What call disables the micro:bit’s 5 x 5 LED display grid?
  2. What is the function of pin6.read_digital()?
  3. Which method is used to dictate the state of the LED?
  4. How does digital_read() impact the I/O pins?
  5. 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.