• 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: Industrial Isolated USB TO 4CH RS485 (B) Converter UART CH344L For Wall/Rail-Mount ESP32 S3 Development Board 3.5 inch LCD Capacitive Touch Screen 3.5inch Display 320×480 N16R8 ESP32 C3 LCD Banana Pi Industrial Grade Isolated USB TO RS232/485 (B) Serial UART Converter FT232RNL For Wall/Rail-Mount Development Board Raspberry Pi 5 RTC ESP32-C6 Industrial-Grade Relay IOT RS485 Communicator UNO Minima RA4M1 ZERO Tiny SuperMini R7FA4M1 Board Compatible With R4 For Arduino Jetson Nano Module Mobile Robot Jetson Nano Case Raspberry Pi 5 PD Trigger Raspberry Pi 5 inch e-Paper ink screen display black white 960×552 For Arduino /Jetson /STM32 /ESP32 Programmable Keyboard 0.85inch Display Raspberry Pi Pico 2 RP2350 1.47 inch LCD B Display Development board RP2350A 1.47inch Screen RGB color Serial Bus Servo Raspberry Pi 8.8 inch DSI MIPI Display LCD Capacitive TouchScreen 480x1920 Code