• 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: Industrial USB TO RS485 2CH Converter FT2232HL Grade Isolated Sensor BG95-M3-Zero QuecPython EVB development support LTE/EGPRS and GNSS ESP32-S3 0.85inch LCD Raspberry Pi 0.96inch RGB OLED Sipeed Lichee Tang Nano1K FPGA MINI Development Board GW1NZ-1 Raspberry Pi 1.54inch OLED ESP32-S3 QMI8658A ESP32-S3 1.28inch Round LCD Display Screen Module Development Board GC9A01A QMI8658A With Case RS232/485/422 To CAN Capacitive Touchscreen ESP32-S3 Industrial 8-CH Relay IOT LAN WiFi /Bluetooth /RS485 /RJ45 Ethernet /POE Smart Car Raspberry Pi 5 RTC Box Raspberry Pi Pico GNSS expansion board L76K GPS Beidou (BDS) GLONASS QZSS A-GNSS For RP2040/RP2350 Raspberry Pi IR Array Thermal Imaging Camera Far infrared 80×62 Pixels 45/90 Degree FOV ESP32 S3 Development Board 2.8 inch B LCD 2.8inch Display 480x640 TouchScreen QMI8658 Sensor / Battery Port LVGL/HMI For Arduino Raspberry Pi UART Raspberry Pi 5 DeepSeek XiaoZhi AI Voice Chat Robot BOX ESP32-S3 Development Board 1.28 inch Round LCD 1.28inch TouchScreen N16R8