• 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: FT232RNL USB TO TTL Industrial UART (C) User Guide Serial UART Bus Servo ST3020 TTL 25KG.CM Magnetic-Encoder High precision and Large torque spotpear Servo PWM motor WP5320 WP5335 35/20KG.CM 180° PWM digital servo double ball bearings SpotPear Raspberry Pi UGV Rover ROS2 PT AI OpenCV Robot Car MediaPipe Raspberry Pi Pico 2 RP2350B 2.41 inch AMOLED Development Board QSPI Display TouchScreen 450x600 RM690BO FT6336 QMI8658 Raspberry Pi 5 POE + PCIe to M.2 NVMe SSD Board HAT+ Pi5 2242/2230 Power over Ethernet Raspberry Pi Raspberry Pi 5 Industrial USB TO RS232/485 Serial UART Converter FT232RNL Compact Size Raspberry Pi RTC WatchDog UART To CAN USB Monitor Raspberry Pi 2inch LCD Jetson Nano 5G module Raspberry Pi Compute Module 5 CM5 Cortex A76 BCM2712 With/Without Wi-Fi RAM 2/4/8/16GB eMMC Lite/8/16/32/64GB Step Recording and Reproduction Pi5 Raspberry Pi 15.6 inch QLED Quantum Dot Display 1920x1080 Capacitive Touchscreen For Computer PC/Jetson/Game $167.99