Light up neopixel strip

Light up a neopixel led strip with just 4 lines of code!


YOU WILL NEED

  • 1 x BBC Micro:bit
  • 1 x Neopixel LED strip
  • 1 x sensor:bit (or any breakout board)

Looking for parts to make this?


STEP 1

Connect the components
(a) Slot a BBC micro:bit to the sensor:bit
(b) Plug in a neopixel light strip to PIN1




Materials

  • 1 x BBC micro:bit
  • 1 x sensor:bit
  • 1 x neopixel LED strip


STEP 2

Importing Extension
To connect a neopixel LED strip, we need to import a special package in MakeCode.

(a) Click on the ‘Advanced’ drawer, select 'Extensions'.

(b) Search for ‘neopixel’ and click on it to import.

(c) You’ll need to re-import the extension again for new projects in the future.



STEP 3

Initialise LED strip
Before coding for the LED strip, we need to initialise it.

(a) In the Neopixel drawer, drag a 'set strop to...' block into on start

(b) Change the pin number

(c) Change the number of pixels



STEP 4

Show rainbow
(a) Right after the LED strip initialisation block, drag a show rainbow block

(b) To make the colors rotate, in a forever block, drag a 'strip rotate pixel' and a 'strip show' block.



STEP 5

Congratulations
You’ve completed your very own 'light show'. Don’t forget to plug a micro USB cable from your laptop to the top of your micro:bit, and click ‘Download’ to download the code to your micro:bit.


Made this activity? Good Job! Now spread the word. Share a photo of your creation on social media with #letsgethacking #Lightupneopixelstrip