Example Code for micro:bit-Read Line-tracking Sensor

- Learning Target: Learn to read the return value of Line-tracking sensor. - Effect: when Maqueen’s line-tracking sensor is put on the black line, the sensor outputs 0, and display 0 on the micro:bit LED matrix; if put on white area, output 1 and display 1 on the LED matrix.

Hardware Preparation

  • Maqueen Lite-micro:bit Educational Programming Robot Platform x 1 (ROB0148)
  • micro:bit board x 1

Software Preparation

  1. Makecode graphical online programming platform: makecode.microbit.org
  2. Maqueen library: Search for "dfrobot" in makecode extension and select "maqueen".

Wiring Diagram

No additional wiring required. The line-tracking sensor is integrated with Maqueen.

Other Preparation Work

Ensure the line-tracking sensor is clean and free of obstructions.

Sample Code

Screenshot of Makecode Graphical Program:

Makecode Program Link: https://makecode.microbit.org/_EvtX1yD0RWpj

Result

No specific result image provided. The expected effect is as described in the project description.

Additional Information


Was this article helpful?

TOP