Introduction
While the micro:bit already has two on-board push buttons, button A and button B, you can add more buttons to control the micro:bit.Â
In this guide, you will learn to connect an external push button to the micro:bit, and get it to turn turn an LED on and off. The push button module is comprised of a momentary push button switch and an in-built resistor.Â
After completing this guide, you will know how to add more buttons to your micro:bit which will come in handy when you go on to make all sorts of projects.
-
-
-
-
-
-
-
-
-
-
pins.setPull(DigitalPin.P0, PinPullMode.PullNone) pins.setEvents(DigitalPin.P0, PinEventType.Edge)
-
input.onPinPressed(TouchPin.P0, function () { pins.digitalWritePin(DigitalPin.P1, 1) }) pins.setPull(DigitalPin.P0, PinPullMode.PullNone) pins.setEvents(DigitalPin.P0, PinEventType.Edge)
-
input.onPinPressed(TouchPin.P0, function () { pins.digitalWritePin(DigitalPin.P1, 1) }) input.onPinReleased(TouchPin.P0, function () { pins.digitalWritePin(DigitalPin.P1, 0) }) pins.setPull(DigitalPin.P0, PinPullMode.PullNone) pins.setEvents(DigitalPin.P0, PinEventType.Edge)
-