Playground Color Picker

You can use your Circuit Playground Bluefruit with the Adafruit Bluefruit LE Connect mobile app to control the NeoPixel RGB LEDs on the CPB!

The Code

Plug your Circuit Playground Bluefruit into your computer, and save the following as code.py on the CIRCUITPY drive:

# CircuitPython NeoPixel Color Picker Example

import board
import neopixel
from adafruit_ble.uart_server import UARTServer
from adafruit_bluefruit_connect.packet import Packet
from adafruit_bluefruit_connect.color_packet import ColorPacket

uart_server = UARTServer()

pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=0.1)

while True:
    # Advertise when not connected.
    uart_server.start_advertising()
    while not uart_server.connected:
        pass

    while uart_server.connected:
        packet = Packet.from_stream(uart_server)
        if isinstance(packet, ColorPacket):
            print(packet.color)
            pixels.fill(packet.color)

Connect to your board through the Adafruit Bluefruit LE Connect mobile app. If you need assistance, check out this page on installing and using the app.

Once connected, from the device menu, tap on Controller, then Color Picker. Choose a color from the dial and tap Select (Android) or Send selected color (iOS). The LEDs will light up in the color you chose!

This guide was first published on Sep 12, 2019. It was last updated on Sep 12, 2019. This page (Playground Color Picker) was last updated on Nov 16, 2019.