Example Code for micro:bit-MindPlus Serial Print

Place a magnet in the sensor detection area, and print the detected data through the MindPlus terminal.

Hardware Preparation

  • 1 x micro:bit
  • 1 x IO Extender for micro:bit
  • 1 x Linear/Analog Hall Sensor
  • 1 x LED Light
  • 1 x Digital Connection Cable

Software Preparation

Wiring Diagram

Sample Code

Result

When a magnet's South pole is facing the sensor detection area, the indicator light on the sensor illuminates, and the analog output value is greater than 512. When a magnet's North pole is facing the sensor detection area, the indicator light on the sensor illuminates, and the analog output value is less than 512. (When no magnetic pole is detected, the analog value is between 500-520.)

Detected South Pole Magnet Detected North Pole Magnet
Effect Display
Serial Output:

Was this article helpful?

TOP