/ README.rst
README.rst
1 Introduction 2 ============ 3 4 .. image:: https://readthedocs.org/projects/adafruit_circuitpython_led_animation/badge/?version=latest 5 :target: https://circuitpython.readthedocs.io/projects/led-animation/en/latest/ 6 :alt: Documentation Status 7 8 .. image:: https://img.shields.io/discord/327254708534116352.svg 9 :target: https://adafru.it/discord 10 :alt: Discord 11 12 .. image:: https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation/workflows/Build%20CI/badge.svg 13 :target: https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation/actions 14 :alt: Build Status 15 16 Perform a variety of LED animation tasks 17 18 Dependencies 19 ============= 20 This driver depends on: 21 22 * `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_ 23 24 Please ensure all dependencies are available on the CircuitPython filesystem. 25 This is easily achieved by downloading 26 `the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_. 27 28 29 Installing from PyPI 30 ===================== 31 On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from 32 PyPI <https://pypi.org/project/adafruit-circuitpython-led-animation/>`_. To install for current user: 33 34 .. code-block:: shell 35 36 pip3 install adafruit-circuitpython-led-animation 37 38 To install system-wide (this may be required in some cases): 39 40 .. code-block:: shell 41 42 sudo pip3 install adafruit-circuitpython-led-animation 43 44 To install in a virtual environment in your current project: 45 46 .. code-block:: shell 47 48 mkdir project-name && cd project-name 49 python3 -m venv .env 50 source .env/bin/activate 51 pip3 install adafruit-circuitpython-led-animation 52 53 Usage Example 54 ============= 55 56 .. code-block:: python 57 58 import board 59 import neopixel 60 from adafruit_led_animation.animation import Blink 61 import adafruit_led_animation.color as color 62 63 # Works on Circuit Playground Express and Bluefruit. 64 # For other boards, change board.NEOPIXEL to match the pin to which the NeoPixels are attached. 65 pixel_pin = board.NEOPIXEL 66 # Change to match the number of pixels you have attached to your board. 67 num_pixels = 10 68 69 pixels = neopixel.NeoPixel(pixel_pin, num_pixels) 70 blink = Blink(pixels, 0.5, color.PURPLE) 71 72 while True: 73 blink.animate() 74 75 Contributing 76 ============ 77 78 Contributions are welcome! Please read our `Code of Conduct 79 <https://github.com/apatt/CircuitPython_LED_Animation/blob/main/CODE_OF_CONDUCT.md>`_ 80 before contributing to help this project stay welcoming. 81 82 Building locally 83 ================ 84 85 Zip release files 86 ----------------- 87 88 To build this library locally you'll need to install the 89 `circuitpython-build-tools <https://github.com/adafruit/circuitpython-build-tools>`_ package. 90 91 .. code-block:: shell 92 93 python3 -m venv .env 94 source .env/bin/activate 95 pip install circuitpython-build-tools 96 97 Once installed, make sure you are in the virtual environment: 98 99 .. code-block:: shell 100 101 source .env/bin/activate 102 103 Then run the build: 104 105 .. code-block:: shell 106 107 circuitpython-build-bundles --filename_prefix circuitpython-led_animation --library_location . 108 109 Sphinx documentation 110 ----------------------- 111 112 Sphinx is used to build the documentation based on rST files and comments in the code. First, 113 install dependencies (feel free to reuse the virtual environment from above): 114 115 .. code-block:: shell 116 117 python3 -m venv .env 118 source .env/bin/activate 119 pip install Sphinx sphinx-rtd-theme 120 121 Now, once you have the virtual environment activated: 122 123 .. code-block:: shell 124 125 cd docs 126 sphinx-build -E -W -b html . _build/html 127 128 This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to 129 view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to 130 locally verify it will pass.