Example Code for micro:bit-Makecode

Last revision 2025/12/19

Write a program using Makecode (example code shown below), burn it to the Micro:bit, and observe the serial port output results.

Hardware Preparation

Software Preparation

Wiring Diagram

Connect the sensor to P1 pin of the expansion board.

Sample Code

Result

When no pressure is detected
When pressure is detected

Additional Information

Note: The greater the force, the higher the detected value will be.

Was this article helpful?

TOP