• 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: Information ESP32-AI Series User Guide ADXL356BEZ TOF Time of Flight Laser Range Sensor Mini Radar module UART Serial / I2C Port For Arduino / Raspberry Pi / ESP32 Raspberry Pi Pico 2 RP2350-Tiny/Tiny-Kit Super Mini Board RP2350A ESP32-P4-ETH RJ45 POE DSI/MIPI 10.1 inch LCD Display Touchscreen/CSI Camera/Audio Speaker AI Deepseek Luckfox Pico ST7789 Raspberry Pi 11.6 inch LCD HDMI /Type C Display In-Cell Capacitive TouchScreen 1768x828 For Jetson Nano/mini Computer PC Sipeed NanoKVM-USB Finger-sized 4K USB KVM for Server/SBCs Raspberry Pi Pico Basics User Guide Raspberry Pi Mipi display Luckfox Pico Camera MIS5001 5MP wide-angle lenses‌ For RV1106/Pro/MAX/Ultra (Not For RV1103 Pico) Raspberry Pi 5 PCIe to M.2 5G/4G/3G HAT With RM520N-GL IO BASE MINI Board Raspberry Pi 5 Camera User Guide ESP32 C6 Development Board 1.47 inch LCD Touch Screen 1.47inch Display 172×320SD AXS5106L JD9853 Serial UART Bus Servo TTL ST3235 30KG.CM Magnetic Encoder 360° High Precision And Large Torque Arduino 0.96inch RGB OLED Industrial Isolated Converter X1203 Raspberry Pi 5 UPS Board Uninterruptible Power Supply For Li-Battery (NOT includ)