NeoPixels

One of the fanciest accessories on Circuit Playground are ten (10!) full color LEDs called NeoPixels. Each of these ten Pixels contain bright red+green+blue sub-LEDs and can display any of 16,777,216 different colors!

These pixels are controlled by a single data pin, #17. Unlike non-smart RGB LEDs, you can set the color and a little chip inside the LED will handle the PWM for you.

Since they are controlled in a chain, you will need to tell the Circuit Playground's NeoPixel code which one you want to set the color for. Each NeoPixel is numbered, starting with #0 at the top left and going counter clockwise till you reach #9

Library Reference

setPixelColor

You can set the color for each pixel with the built in NeoPixel library:

CircuitPlayground.setPixelColor(n, red, green, blue)

Where n is between 0 and 9 and indicates which LED you are setting. red/green/blue vary between 0 (off) and 255 (full on)

clearPixels

You can quickly turn all the LEDs off with CircuitPlayground.clearPixels()

setBrightness

By default the global brightness of the LEDs is set to 30 out of 255. This means that the LEDs won't be insanely bright when you first use them.

You can change the global brightness at the beginning of the sketch (in setup) by running CircuitPlayground.setBrightness(b) where b varies from 0 (no LEDs will ever light) to 255 (incredibly bright!)

setBrightness only affects pixel colors set after it is called. That is, if you set an LED color and then call setBrightness, it wont affect that older LED color. Only going forward will the brightness change to be different.

Last updated on 2016-07-18 at 09.07.00 PM Published on 2016-07-19 at 08.31.23 PM