• 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 18.5 inch Type C/HDMI/4K Display Screen 3840×2160 Computer PC Phone Xbox/PS4/Switch RS485 to Ethernet NVIDIA Jetson Orin Nano 4/8GB AI 20/40Tops Lower Power Autonomous Machines Raspberry Pi 5 / 4B UPS With PD Trigger Activation Uninterruptible Power Bank Supply 9600mAh 5V/5A 25W Also For Phone/Mini Computer PC Raspberry-Pi-ESP32-Pico-Display-image-1.83inch-LCD-NV3030B-ADD-NEW-Picture FT4232HL USB TTL RS232 Industrial UART 4-Ch UART ESP32-S3 Relay 6-Channel IOT WiFi Bluetooth RS485 Pico Protection Circuits Raspberry Pi Pico Screen RK3566 Milk-V Duo User Guide USB TO 4CH RS485 User Guide Luckfox Pico 1.3inch LCD RP2040-PiZero Game ST7789 Raspberry Pi Pico LCD Display Screen Good low light performance DeepSeek ESP32-S3 Voice Chat Robot espHome XiaoZhi Ball Raspberry Pi 1.3inch IPS LCD display HAT MP2.5G Raspberry Pi 5 PCIe to 2.5G Ethernet HAT Pi5 RTL8125 Raspberry Pi5 DC-DC Step-Down Mini voltage Moudle Input 5~36V voltage Output 5V/3.3V 4A Raspberry Pi 5 NVMe