Questions
- Answer: 1 / 4 and 2 / 3
- Answer: 3.3 V. The two sides of the pushbutton are electrically connected and therefore the circuit is completed.
- Answer: A pull-down resistor “pulls down” the resting state voltage that the circuit applies to GND = 0 V.
- Answer: When a pushbutton is pressed and becomes connected to 3.3 V it is called active-high.
- Answer: The voltage applied to the circuit.
Exercises
- Answer: It is the reverse.
- Answer: It disables the display.
- 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)