@@ -13,15 +13,13 @@ Introduction
13
13
:target: https://travis-ci.org/adafruit/Adafruit_CircuitPython_pixie
14
14
:alt: Build Status
15
15
16
- .. todo :: Describe what the library does.
16
+ .. A driver for Pixie - 3W Chainable Smart LED Pixel
17
17
18
18
Dependencies
19
19
=============
20
20
This driver depends on:
21
21
22
22
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython >`_
23
- * `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice >`_
24
- * `Register <https://github.com/adafruit/Adafruit_CircuitPython_Register >`_
25
23
26
24
Please ensure all dependencies are available on the CircuitPython filesystem.
27
25
This is easily achieved by downloading
@@ -30,7 +28,38 @@ This is easily achieved by downloading
30
28
Usage Example
31
29
=============
32
30
33
- .. todo :: Add a quick, simple example. It and other examples should live in the examples folder and be included in docs/examples.rst.
31
+ .. code-block::python
32
+
33
+ import time
34
+ import board
35
+ import adafruit_pixie
36
+ import busio
37
+
38
+ uart = busio.UART(board.TX, rx=None, baudrate=115200)
39
+
40
+ num_pixies = 2 # Change this to the number of Pixies LEDs you have.
41
+ pixies = adafruit_pixie.Pixie(uart, num_pixies, brightness=0.2, auto_write=False)
42
+
43
+
44
+ def wheel(pos):
45
+ # Input a value 0 to 255 to get a color value.
46
+ # The colours are a transition r - g - b - back to r.
47
+ if pos < 0 or pos > 255:
48
+ return 0, 0, 0
49
+ if pos < 85:
50
+ return int(255 - pos * 3), int(pos * 3), 0
51
+ if pos < 170:
52
+ pos -= 85
53
+ return 0, int(255 - pos * 3), int(pos * 3)
54
+ pos -= 170
55
+ return int(pos * 3), 0, int(255 - (pos * 3))
56
+
57
+
58
+ while True:
59
+ for i in range(255):
60
+ for pixie in range(num_pixies):
61
+ pixies[pixie] = wheel(i)
62
+ pixies.show()
34
63
35
64
Contributing
36
65
============
0 commit comments