Science Oxford Logo

Neopixels

Neopixels are special LEDs connected together - you can program them all seperately from only one pin of the micro:bit!

If you are Science Oxford's workshop, you will have a choice of either a firm stick of 8, or a flexible strip of 10.

Science Oxford Logo

Wiring your Neopixels

Connect long jump leads up to your Neopixels, so that you have wires to connect your crocodile clips to.

Neopixels have three connections:

Science Oxford Logo

Coding your Neopixels

To set them up, add the following lines of code:

import neopixel
lights = neopixel.NeoPixel(pin0, 10)

In the brackets of the second line above, change pin0 to the pin you have connected your Neopixels to, and 10 to the number of LEDs on your stick or strip.


Add the following code into your program and test it:

for pixel in range(0, len(lights)):
    lights[pixel] = (100, 0, 0)
    lights.show()

This code does the following things:

See what you can change to make it behave differently.


Some example code is here.