Skip to content

Commit 01c39fa

Browse files
authored
Merge pull request #1 from kattni/documentation-setup
Documentation setup
2 parents 6821b58 + af6ebca commit 01c39fa

File tree

3 files changed

+34
-10
lines changed

3 files changed

+34
-10
lines changed

README.rst

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ Introduction
1313
:target: https://travis-ci.org/adafruit/Adafruit_CircuitPython_pixie
1414
:alt: Build Status
1515

16-
.. todo:: Describe what the library does.
16+
.. A driver for Pixie - 3W Chainable Smart LED Pixel
1717
1818
Dependencies
1919
=============
2020
This driver depends on:
2121

2222
* `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>`_
2523

2624
Please ensure all dependencies are available on the CircuitPython filesystem.
2725
This is easily achieved by downloading
@@ -30,7 +28,38 @@ This is easily achieved by downloading
3028
Usage Example
3129
=============
3230

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()
3463
3564
Contributing
3665
============

docs/index.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,11 @@ Table of Contents
2323
.. toctree::
2424
:caption: Tutorials
2525

26-
.. todo:: Add any Learn guide links here. If there are none, then simply delete this todo and leave
27-
the toctree above for use later.
2826

2927
.. toctree::
3028
:caption: Related Products
3129

32-
.. todo:: Add any product links here. If there are none, then simply delete this todo and leave
33-
the toctree above for use later.
30+
.. https://www.adafruit.com/product/2741
3431
3532
.. toctree::
3633
:caption: Other Links

requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
adafruit-circuitpython-busdevice
2-
adafruit-circuitpython-register

0 commit comments

Comments
 (0)