Alphabot2 for micro:bit User Manual
16 / 76
2. Place show string block in on button pressed block to display string on LEDs
display. Duplicate and complete the script to as below:
3. Connect your micro:bit to PC, click Download to flash the code to your board.
Press buttons on micro:bit to test if expected string is displayed.
PRESSING 2
There is another way to detect buttons. In last section, codes are run when button is
pressed, here we use if then and button is pressed blocks to do the same thing.
Instead of running code directly, a Boolean value
“true” is returned if button is
pressed, “false” if button is not be pressed.