• 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 DeepSeek AI Voice Chat ESP32 C6 Development Board 2.06-inch AMOLED Display 410×502 2.06inch TouchScreen Programmable Watch Raspberry Pi 3.97 inch e-Paper link (G) RYBW 800x480 For Arduino / Jetson / STM32 /ESP32 ESP32-C6 Geek 1.14inch Development Board with 1.14 inch 65K Color LCD RS232/485/422 To CAN RS485 Bus SpotPear D-Robotics RDK X3 MD Carrier Board For RDK X3 Module Horizon Sunrise Pi ARM Cortex-A53 5Tops Raspberry Pi Pico 2 RP2350B 2.1 inch Round LCD Touch Display 480x480 HMI LVGL QMI8658 6-axis 65K Colors Raspberry Pi 21.5inch FHD LCD 1080x1920 Capacitive TouchScreen Display For Raspberry Pi/Jetson Nano/ Raspberry Pi Industrial RJ45 Ethernet To 16-ch Relay Module Modbus RTU TCP With Protection and guide rails ESP32-S3 QMI8658A Raspberry Pi CM4 AI Board English Character Display Principle ESP32 Display Gyroscope Sensor ESP32 C3 LCD Development Board 1.3 inch Display Screen ST7789 240x240 3D Transparent Refractive Prism Mini TV For Arduino DeepSeek AI Voice Chat Robot ESP32 S3 Camera Object Recognition Development Board N16R8 For Xiaozhi Dual microphone interruption