• 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-Game-1.54inch-LCD-touchscreen-display-ST7789 DeepSeek AI Voice Chat Camera Robot BOX ESP32-S3 Development Board 2 inch LCD N16R8 Touchscreen Display Camera Jetson Orin 4G/3G/2G expansion board GNSS GPS SIM7600G-H-M.2 luckfox-pico-ultra-w-gpio Use Raspberry Pi Pico 1.14inch LCD ESP32-S3 Development Board 1.47 inch LCD 1.47B Display 1.47inch Screen SD 172×320 RGB LED Raspberry Pi Pico 2 Tiny RP2350B RP2350-Linux Mini Development Board with PSRAM-8MB Or Without PSRAM SpotPear Raspberry Pi IR Ther Raspberry Pi 8 inch DSI MIPI LCD TouchScreen Display 8inch 800x1280 For Luckfox Lyra RK3506/ESP32-P4/Luckfox Omni3576 Pi5 Active Cooler Raspberry Pi USB Camera 2MP OV2735 Distortion-Free USB 2.0 For Jeston RDK Vertical Drag Instructions ESP32 C3 Round LCD Development Board Electronic EYE 0.71 inch Display Watch Screen GC9D01 160x160 X1201 Raspberry Pi 5 UPS Board Uninterruptible Power Supply For 18650-Li-Battery (NOT includ) Retail electronic Labe 5inch USB Monitor Sipeed MaixCAM Pro AI Camera Kit SG2002 RISC-V YOLO OpenCV Audio WIFI6 Linux Board IMU MicroPhone Speaker Banana Pi Jetson Orin Nano/NX Super Developer IO Base Development Board Dual network RJ45 For Jetson Orin Nano/NX Module