• sales

    +86-0755-88291180

Chapter 2 of KitiBot-Microbit: Keys User Guide

Keys

There are two keys on Micro:bit, A and B. In this Chapter, we are using them.


Keys programming we need to use the block "on button .. pressed". With the block, the micro:bit could detect if key A is pressed or if A and B keys are pressed at the same time. If the key is pressed, the scripts in this block will run.


According to Chapter 1, let's learn how to program keys. We try to create a project that LED matrix display A, B and C separately when key A, B, A and B are pressed.


First, create new project. Find block "on button A pressed" in Input class and drag it to the right. Add one string display block. Copy the button and string blocks change for B key and AB keys operation.

Download the code to micro:bit for testing. You can also check the effect according to left simulate area.

Buttons could also be controlled by another block. Different with the last one, the block we used before run the included program when buttons are pressed. This block will return a value "true" if buttons are pressed, otherwise return value "false"


We create a new project and rewrite it with this block. In this project, we need to use if-else block. If it get ture, the blocks included will run, otherwise the blocks in else will run.


Add blocks that display string when buttons are pressed. You can simulate the effect on the left area


If you are much careful, you will find that the project first detect if A and B are pressed at the same time, then detect if A and B is pressed separately. You can try to change the order to test what will happen if the order is changed

TAG: Raspberry Pi DSI ESP32-S3 AI 3.97-inch e-Paper Ink Screen 3.97inch Display AIoT Development Board Deepseek Milk-V Duo S eMMC version firmware burning Raspberry Pi Pico 2 RP2350 0.85 inch LCD Display mini Development Board 0.85inch Screen RGB LED/SD Slot /QMI8658 Gyroscope Sensor Raspberry Pi 5 IMX219 ESP32 C6 Development Board 1.47 inch LCD Touch Screen 1.47inch Display 172×320SD AXS5106L JD9853 Luckfox Pico LCD Font-Modulation-Tutorial User Guide spotpear Raspberry Pi Mini TV ESP32-C6 LCD Development Board 1.3 inch Display 1.3inch Screen ST7789 240x240 Mini TV SD-Port QST LVGL For Arduino SpotPear ESP32 S3 R8 MP3 Board 2.8inch LCD TouchScreen Display Speaker/SD-Card/Battery/QMI8658-6-Axis-Sensor Raspberry Pi 7 inch HMI industrial DSI Display LCD 7inch TouchScreen Computer 720×1280 Raspberry Pi Compute Module 5 PoE BASE A IO Board RJ45 For CM5 Lite/eMMC Raspberry Pi 3.97 inch e-Paper link (G) RYBW 800x480 For Arduino / Jetson / STM32 /ESP32 Spotpear ESP32-P4 PICO Development Board with MIPI DSI 10.1-inch Display i5-1135G7 Raspberry Pi 5