RoboFacetRoboFacet

micro:bit V1 / V2 · MakeCode or Python

micro:bit automatic nightlight

Use a light reading and a simple rule to turn the onboard LED display on in the dark. Start in the simulator, then try the same logic on a board.

Start with the basics

What you will build

The LED display turns on when the surroundings become dark and off when they become brighter.

Before you start

  • No external circuit is needed. Begin with a loop and a condition in the official example.
See materials, equipment and tools

Model and software requirements

  • The official project supplies MakeCode, Python and HEX entry points. V1 and V2 can use the onboard light reading.
  • Use the original editor's example. A light threshold is an adjustable example, not a universal calibration value.

Similar products, older hardware and other software versions are not automatically interchangeable.

Materials & equipment checklist

Check items as you prepare them. Follow each source for part specifications, kit contents and assembly requirements.

This checklist is for the physical route. Simulator-only use does not require these hardware items.

0 of 3 required materials ready

Checks stay on this page only and are not uploaded. Refreshing or leaving resets them.

Required materials

  • × 1

    Needed for the physical route, not for the simulator. The light sensor uses the onboard LED display.

    Material reference
  • × 1

    For transfer and USB power; use the connector required by the board.

    Material reference
  • Use available light and a way to shade the board; the original project specifies no purchase model or quantity.

    Material reference

Optional materials

  • × 1

    Only if running away from USB power.

    Material reference
  • × 2

    For the optional compatible battery holder; follow the official power guidance.

    Material reference

Equipment & tools

  • A computer with a browser. The simulator is enough to explore the rule; physical testing needs a board and USB data cable.

Build route

Follow the original instructions in order. This overview does not replace wiring diagrams or calibration procedures.

  1. 1

    Read the rule

    Open the project and identify the light input, condition and LED output.

    Open this step
  2. 2

    Try the official program

    Choose MakeCode or Python. In MakeCode, change the simulated light level to observe the rule.

    Open this step
  3. 3

    Transfer to hardware

    Follow the official transfer procedure and power the board by USB or a compatible battery pack.

    Open this step
  4. 4

    Adjust the threshold

    Compare brighter and shaded conditions, then adjust the program's threshold for the test environment.

    Open this step

First-run checks

  • Shading and illumination produce the expected LED changes.
  • Changing the threshold changes when the LEDs turn on.

Outside this project's scope

  • This is a sensor-and-control exercise, not a room light, precise lux meter or mains appliance controller.
  • Simulator success does not verify the real sensor, cable or power supply.

Assembly and operation notes

  • Handle the board by its edges and follow the official battery and board safety guidance. Do not connect mains electricity.

What to include in your budget

  • Count the board or kit, data cable and optional batteries separately. The simulator route does not require a hardware purchase.

Original documentation and code

  • MakeCode, Python and HEX entry points are on the original page; source content is CC BY-SA 4.0.

  • Transfer codePublic resource
  • Power requirementsPublic resource
  • Board safetyPublic resource

Sources accessed: 2026-10-14. This page is compiled from the original documentation and has not been hardware-tested by RoboFacet. Check the original source for kit contents, prices and software updates.

More projects in this area