Welcome to the DFRobot blog
:
www.dfrobot.com/blog-tag-microbit.html
26
/
86
1
×
USB cable
Connection
Connect the button module (knob module) to P0
Connect the LED module to P1
Program
Task 1: button controlled lamp
Goal: when the button is pressed, the LED module turns on. When the button is released, the LED
turns off.
STEP 1: Connect the button module to P0. By reading the value of P0, micro: bit will then get the
status of the button. To link the button with the LED, we can write a simple program: When the
button is pressed micro: bit receives a “1”, so we will then set the value of the LED (pin 1) as 1 and
the LED turns on. When released, set the value of the pin as 0 and the LED turns off. This button
module is a digital input module and the “digital read” function can be found under “Advance"
->"Pins".