The Neopixel() function is used to control NeoPixel (WS2812) LEDs. Those smart LEDs have a small processor built inside of them. An incoming digital signal sets each LED to a specific color. This way, several LEDs can be controlled using a single pin.

Neopixel() needs to know what pin to use and the count of the LEDs connected to that pin.


All LEDs can now be set to a specific color.

var neo = Neopixel(P1,3);
neo = Neopixel(P1,3)
Out(neo, Green)

We then can also set each LED individually by using an array of color[]. Colors can be one of the predefined ones or a hex color value.

var neo = Neopixel(P1,3);
var color = new[] {White,0x0F8000,Red};
neo = Neopixel(P1,3)
color = [White,0x0F8000,Red]
Out(neo, color)

To determine the color value, use search the web for “Color picker” and use the hex value. Note that the websites use # to mark a hex value, but in coding we typically use 0x.


How small can a processor be? We are now talking about a processor that is smaller than an ant! Here is a fun fact, a processor is usually smaller than the packaging around it. The packaging is made larger so it can be handled easier.