19 tra Dancing micro:bit
Using the commands:
– on start,
– set P0 to touch mode capacitive,
– on pin pressed,
– show icon,
– show leds
create a program where the micro:bit displays 3 different icons of a stick figure depending on which pin is pressed. Pins P1 and P2 should have capacitive touch, and pin P0 resistive. Resistive touch involves pressing a pin and GND simultaneously, closing a circuit and sending a signal to the micro:bit, while capacitive touch reacts to changes in the electric field caused by the presence of a conductive object, such as a finger. By default, all 3 pins have resistive touch.
1.
Inside the on start block, place the set P0 to touch mode capacitive command. You can find it in the Advanced part, category named Pins (more). Select P1 pin from the dropdown menu. Duplicate the same command and select P2 from the dropdown menu.
3.
Again, take the on pin P0 pressed block and change the pin to P1 from the dropdown menu. With the show leds command create slightly different stick figure icon.
2.
From the Input category take the on pin P0 pressed block. Inside the block, put the show icon command and choose the stick figure icon.
4.
Repeat the last step but change the pin to P2 from the dropdown menu. With the show leds command create again slightly different stick figure icon.
Although your programs are created using Blocks, you’ll need to copy the JavaScript code of your created program for solving certain escape room tasks. After you create a program in MakeCode Blocks editor, you can see its JavaScript version by going to JavaScript mode.
Copy the JavaScript code from your Dancing micro:bit program and paste it into the box below:
This publication reflects the views only of the author, and the Commission cannot be held responsible for any use which may be made of the information contained therein.