• 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 Pico Display X1010 Raspberry Pi 5 PCIe FFC Connector to Standard PCIe x4 Slot Expansion Board Raspberry Pi Pico RP2040 C Environment Window Arducam 64MP Camera ESP32-S3 AI Voice Dialogue Robot Mechanical Dog Development Board Toy Tabletop Pet Deepseek Computer Desktop Monitor Display D-Robotics RDK X3 Development Board Horizon Sunrise Pi ARM Cortex-A53 5Tops 2GB/4GB RAM Sipeed Lichee Tang Nano 9K FPGA MINI Development Board GW1NR-9 GOAI Gowin Raspberry Pi Pico 2 RP2350 Core2350B Core Board PSRAM Arduino board manager tutorial User Guide ESP32-S3 LCD AV to LVDS Raspberry Pi 10.85 inch e-Paper ink screen display black white 1360×480 For Arduino /Jetson /STM32 /ESP32 Jetson Orin Nano UGV Beast PT ROS2 AI OpenCV Robot Car MediaPipe ESP32 S3 Development Board 1.64 inch AMOLED Display 1.64inch TouchScreen For Arduino LVGL With SD-Port/ QMI8658C 6-Axis Sensor 4inch Round LCD HDMI Capacitive Touchscreen Display 720x720 For Raspberry Pi/Jetson Nano/mini PC Development Board Raspberry Pi 5 Raspberry Pi AI HAT+ Official Original Hailo-8/8L 13/26Tops For Pi5 PCIe M.2 Gen3 X1011 Raspberry Pi 5 PCIe to M.2 NVMe 4-Ports SSD Board HAT Pi5 Four-Times 2280