Control multiple LEDs and lights easily with your Micro:bit using the LightPins extension. This extension works for micro:bit V1 and V2.
Watch this tutorial to see LightPins in action:
Transistor & LED Tutorial
Use the following link to import the extension:
LightPins Extension
You can add this repository as an extension in MakeCode:
- Open MakeCode for micro:bit
- Click New Project
- Click Extensions (under the gear menu)
- Search for:
https://github.com/noidvr/LightPinsand import it
⚠️ Make sure you follow the pin usage instructions below to avoid damaging your Micro:bit.
- Maximum total current for all GPIO pins: 15 mA
- Avoid switching on more than a few pins at once without a current limiter
- Recommended options for multiple LEDs:
- Transistors
- Shift registers
- NeoPixels
Important pins:
- Pins 5 and 11 → buttons A and B
- Pin 9 → available on V2 without disabling the LED display
- Pins 8 and 16 → available on both V1 and V2
To edit this repository in MakeCode:
- Open MakeCode for micro:bit
- Click Import → Import URL
- Paste:
https://github.com/noidvr/LightPins - Click Import
Here are some example code snippets using LightPins blocks:
// Turn on LED at pin P1 for 1 second
lightPins.setPin(P1, 1)
basic.pause(1000)
lightPins.setPin(P1, 0)