• 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: ESP32-S3 GEEK Raspberry Pi Pico Basics User Guide 1.83inch LCD TouchScreen Display 240×280 NV3030B Arduino Raspberry Pi ESP32S3 Pico STM32 Computer Desktop Monitor Display Milk-V Duo Camera Tutorial Solar Charge Module USB Camera 2MP GC2093 ‌WDR Backlight Compensation‌ Onboard microphone ESP32-S3 Industrial 8-CH Relay IOT LAN WiFi /Bluetooth /CAN /RJ45 Ethernet /POE Sipeed Lichee Tang Nano 4K FPGA MINI Development Board W1NSR-LV4C GOAI Gowin Raspberry Pi Pico Raspberry Pi 5 User Guide Raspberry Pi 5 UPS HAT E 4-Port For 21700-Li-Battery (NOT includ) 5V6A Uninterruptible Power Supply Raspberry Pi IR Ther LCD1602 I2C Module PWM Adjustable backlight 3.3V/5V For Arduino/ Raspberry Pi/ Pico/ Jetson Nano/ ESP32 Raspberry Pi 1.54inch OLED Raspberry Pi LCD Display Screen 1.3inch LCD with Game Button AND Audio Buzzer For Zero 2W / 3B / 4B / PI5 / RP2040-PiZero EoAT Setting Arduino Thermal imaging Raspberry Pi Display Driver Board Raspberry Pi 5 Official Original PCIe to M.2 NVMe SSD Raspberry Pi M.2 HAT+ Board For Pi5