Skip to main content

A library to control WS2812 LEDs using SPI on Orange Pi

Project description

WS2812-GPT-LP

This library allows you to control WS2812 LEDs using SPI on Orange Pi. Cette bibliothèque permet de contrôler les LEDs WS2812 via SPI sur Orange Pi.

Installation

pip install ws2812-gpt-lp

Usage

from ws2812_gpt_lp import WS2812

Configuration

num_leds = 8 ws2812 = WS2812(spi_bus=4, spi_device=0, num_leds=num_leds)

Set colors for 8 LEDs

colors = [ (255, 0, 0), # Red (0, 255, 0), # Green (0, 0, 255), # Blue (255, 255, 0), # Yellow (0, 255, 255), # Cyan (255, 0, 255), # Magenta (255, 255, 255), # White (0, 0, 0) # Black (off) ]

Send colors to LEDs

ws2812.send_colors(colors)

Change the color of the first LED to blue

ws2812.send_color(0, 0, 0, 255)

Turn off all LEDs

ws2812.send_off()

Set all LEDs to red

ws2812.send_to_all(255, 0, 0)

Close the SPI connection

ws2812.close()

Note

You must solder a 100nF capacitor between the VCC and GND of the WS2812 LEDs to avoid interference.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Authors

This library was jointly developed by Laurent Pastor and ChatGPT 4.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ws2812_gpt_lp-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ws2812_gpt_lp-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file ws2812_gpt_lp-0.1.0.tar.gz.

File metadata

  • Download URL: ws2812_gpt_lp-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.2

File hashes

Hashes for ws2812_gpt_lp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2b36a16618da8f20fc6107350efcf25ba7c053d4e8214fe27db34624ec2f6a93
MD5 ef1765f309e0f901e140ed6db0558c66
BLAKE2b-256 e8c5b60aeea1b994fb9681e154fff19ea65fbfb356b44e32b08a03263fa29a24

See more details on using hashes here.

File details

Details for the file ws2812_gpt_lp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ws2812_gpt_lp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.2

File hashes

Hashes for ws2812_gpt_lp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 915980b860514e30a395677a170d225c06cceaa39688595d1d126b7ba8c6cc36
MD5 4f3501bd4b35476837c57aa2cda3d1a5
BLAKE2b-256 106b7f326f3f43a79af3af47a48ac6b6e3896c31db1e080884b8fba3a47c896c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page