Solutions

Questions

  1. Answer: 1 / 4 and 2 / 3
  2. Answer: 3.3 V. The two sides of the pushbutton are electrically connected and therefore the circuit is completed.
  3. Answer: A pull-down resistor “pulls down” the resting state voltage that the circuit applies to GND = 0 V.
  4. Answer: When a pushbutton is pressed and becomes connected to 3.3 V it is called active-high.
  5. Answer: The voltage applied to the circuit.

 

Exercises

  1. Answer: It is the reverse.
  2. Answer: It disables the display.
  3. Answer:  It disables the microbit’s internal pull-down resistor.

 

Project

Solution:

Hint: Combine scripts from this activity and Build and Test a Pushbutton.

# pushbutton_pullup_with_red_LED

from microbit import *

state = 0
display.off()
pin9.set_pull(pin9.NO_PULL)

while True:
    state = pin9.read_digital()
    print("state = ", state)
    sleep(250)
    
    if state == 1:
        pin15.write_digital(1)
        sleep(250)
    pin15.write_digital(0)
    sleep(250)