• 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 5 PCIe to M.2 NVME SSD And Gigabit Ethernet RJ45 HAT RTL8111H M_KEY For 2230/2242/2260/2280 Sipeed Lichee Tang Nano1K FPGA MINI Development Board GW1NZ-1 R7FA4 PLUS B Development Board Based on R7FA4M1AB3CFM Compatible with Arduino UNO For R4 WiFi Raspberry Pi Pico 2 RP2350 1.64 inch AMOLED Development Board Display TouchScreen 280x456 QMI8658 IMU QSPI 2.8inch Round LCD USB Monitor Computer Monitor Display Screen USB Type C Secondary Screen PC CPU GPU ISX031C GMSL Camera H100 Image Sensor IP67 protection rating For Jetson Orin And MAX9296 GMSL camera NVIDIA Jetson Orin Nano 4/8GB AI 20/40Tops Lower Power Autonomous Machines Industrial USB TO RS485 Isolated Bidirectional Converter Original (E) FT232RNL 1200m Long Distance Development Board Raspberry Pi 5 BPI AI Machine Vision Kit OAK-D-POE JPEG Encoder 12MP IP67 Waterproof 4TOPS OpenCV Camera Raspberry Pi Pico 2 W RP2350 Pico2W ARM Cortex-M33 And RISC-V Hazard3 Wi-Fi4 Bluetooth5.2 CYW43439 Jetson 1.5inch LCD Raspberry Pi 4/4.3 inch DSI MIPI LCD TouchScreen Display 4/4.3inch 480x800 For Luckfox Lyra RK3506/ESP32-P4/Luckfox Omni3576 Milk V Duo Luckfox Pico Camera MIS5001 5MP wide-angle lenses‌ For RV1106/Pro/MAX/Ultra (Not For RV1103 Pico) Raspberry Pi PCM5122 I2S DAC HIFI Sound Card DAC Audio expansion Board Free-Driver For PI5/PI4/Zero ESP32-S3 Round LCD CAM-GC2083