How to Use Button Module with Micro:bit?
Overview
When design the circuit, button switch is a commonly used component. The micro:bit main board has two built-in buttons, however, sometimes still need to use external button when design the circuit. So in this project, you will learn how to use our push button module to control 5*5 LED of micro:bit display different images.
Component Required:
-
Micro:bit main board*1
-
Keyestudio Micro bit Sensor V2 Shield*1
-
USB Cable*1
-
keyestudio Digital Push Button*1
-
keyestudio Digital White LED Module*1
-
DuPont jumper wire*6
-
Premium Battery Holder 6-cell AA*1
-
1.5V AA Battery*6
Component Introduction
Digital Push Button Module:
The buttons are common input devices. You will have used a power button to switch off the mobile or tablet, or volume buttons to turn the audio level up or down. The buttons on the BBC micro:bit are input devices that can be pressed to trigger an action. You can write a program to tell the micro:bit what actions should happen when the button is pressed, and there are lots of you can program. There are two buttons on the micro:bit, button A and button B. The button can be pressed separately or together. There is a third button on the other side, that’s for resetting your micro:bit and start your program from the beginning.
Connection Diagram
Test Code
Test Results
Wire up according to connection diagram, connect to external power, upload code to micro:bit, press button and LED is on; when button is released, LED is off.