Example Code for micro:bit-MakeCode-Lighting Console
The article outlines how to set up a micro:bit lighting console using MakeCode, detailing hardware requirements, wiring diagrams, and sample code to control LED brightness via a potentiometer.
Hardware Preparation
- Components: 7 jumper wires. 1 LED light, 1 potentiometer.
- Pin: connect the potentiometer to P0, the LED to P1.
Software Preparation
- Makecode: Click to enter makecode online programming environment: https://makecode.microbit.org/
Wiring Diagram

Sample Code
- Screenshot of makecode graphical codes:

Result
Rotate the potentiometer counterclockwise to brighten the LED, clockwise rotation to dim the LED.
Was this article helpful?
