Example Code for micro:bit-Light-operated Sprite

- Learning Target: Learn to let the car follow the light. - Effect: As the flashlight illuminates the LEDs on Maqueen, the vehicle starts to move forward. The brighter the light is, the faster Maqueen moves.

Hardware Preparation

  • Maqueen Lite-micro:bit Educational Programming Robot Platform x 1 (ROB0148)
  • micro:bit board x 1
  • Flashlight 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 ambient light sensor is integrated with Maqueen.

Other Preparation Work

Ensure Maqueen is in a dim environment before testing.

Sample Code

Screenshot of Makecode Graphical Program:

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

Result

Light-operated Sprite

Additional Information

No additional content provided.

Was this article helpful?

TOP