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. Tested on Orange Pi 5 plus. Cette bibliothèque permet de contrôler les LEDs WS2812 via SPI sur Orange Pi.

Installation

pip install ws2812-gpt-lp

Usage example

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()

[color=#ee0210]Important Note[/color]

[color=#ee0210]You must solder a 100nF capacitor between the VCC and GND of the WS2812 LEDs to avoid interference.[/color]

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.3.tar.gz (4.0 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.3-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ws2812_gpt_lp-0.1.3.tar.gz
  • Upload date:
  • Size: 4.0 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.3.tar.gz
Algorithm Hash digest
SHA256 4d6f258c9b6b7f15c156b87cac839d031f6d7d64d80046a98c1cdb1ebd0306a1
MD5 f963b6768c463ad7d511cbfd362ca8ac
BLAKE2b-256 e507c4583955f4158bca13e219ae7b1c39d3c77dc79de2287b29413d104960ba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ws2812_gpt_lp-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 adee76ed158b3083fee992b5843f4f52394b9c61e5b44183f341ed58da92e7b8
MD5 8554091cb370c62ce330397f98622738
BLAKE2b-256 81e8fe2fce768cc12a17d896fd5c7b0dd524b86c8e22d20d82c2c74a0e2e5a5c

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