micro:bit RGB Xmas Tree

rainbowWARNING: when you connect the tree to your micro:bit and apply power, the LEDs may immediately illuminate at full brightness. These could be very bright and damaging if you look directly at them. Make sure the tree is pointing away and don’t look directly at it when you first apply power.

Generally, avoid running the LEDs at full brightness.


Connecting the tree to the micro:bit

With the power off, use crocodile clips leads to make the following connections:

  • GND on the tree to GND on the micro:bit
  • 3V on the tree to 3v on the micro:bit
  • SOUND on the tree to pin 0 on the micro:bit
  • LED on the tree to pin 2 on the micro:bit

microbitProgramming your micro:bit

To use the following code, you will need to add the NeoPixel extension. To do this, click Advanced and then Extensions. Click on the NeoPixel extension and you will now have additional blocks that can be used to enter the code below making sure to make the following changes to the default settings:

  • Change the NeoPixel pin to P2 (the default is P0)
  • Change the number of LEDs to 5 (the default is 24)
  • Set the brightness (under “more”) to 50 rather than the default of 255

Once the code is entered, download it to your micro:bit. The sound only plays at the beginning so you may want to press the reset button on the rear of the microbit to hear it again.