Introduction

Documentation Status Discord Build Status

Brightly is a library based Adafruit’s CircuitPython Python implementation with functions to generate simple LED patterns and animations. It is designed to work with the Brightly Code Generator to create an easy to use drag-and-drop coding interface for Neopixels on CircuitPython capable boards.

Dependencies

This library depends on:

The current brightly.mpy library is compatible with CircuitPython 4

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle

Usage Example

See examples/main.py

Contributing

Contributions are welcome! Please read the Code of Conduct before contributing to help this project stay welcoming.

Table of Contents

Simple test

Ensure your device works with this simple test.

examples/main.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#Auto generated CircuitPython Code
import board
import neopixel
import time
import brightly
numpix = 14

strip = neopixel.NeoPixel(board.D1, numpix, brightness=0.15, auto_write=False)
brightly = brightly.Brightly(strip, numpix)

while True:
    brightly.wipe(0.05, 1, (255, 0, 0))
    brightly.wipe(0.05, -1, (0,0,255))
    brightly.twinkle(8, [(255,0,0),(0,255,0),(0,0,255)], 5)
    brightly.scroll_morse("hi there", (255,0,0))
    brightly.smooth_change_to((0,255,0))
    brightly.smooth_change_to([(255,0,0),(201,54,0),(147,108,0),(90,165,0),(36,219,0),(0,237,18),(0,183,72),(0,126,129),(0,75,180),(0,18,237),(33,0,222),(90,0,165),(144,0,111),(198,0,57)])
    for i in range(16):
        brightly.smooth_rotate_pix(1)
    for i in range(16):
        brightly.set_pixels([(255,0,0), (0,0,0), (255,0,0), (0,0,0), (255,0,0), (0,0,0), (255,0,0), (0,0,0), (255,0,0), (0,0,0), (255,0,0), (0,0,0), (255, 0, 0), (0,0,0)])
        time.sleep(0.4)
        brightly.smooth_change_to([(0,0,0), (255,0,0), (0,0,0), (255,0,0), (0,0,0), (255,0,0), (0,0,0), (255,0,0), (0,0,0), (255,0,0), (0,0,0), (255, 0, 0), (0,0,0), (255, 0, 0)])

Indices and tables