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.1.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.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ws2812_gpt_lp-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 7709a5dc12efa680c65c9deb6f660a0191cf05445bca3706097b75b6701a29c8
MD5 de562a12779c273d033f2c88385da12c
BLAKE2b-256 6f44ef5d85fab23745d1705d16358438ea8667f15ab5bd5b98de39cac35d0380

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ws2812_gpt_lp-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6d0bbf6fde2b452f7de890791aca2b2fb3eef60cd59087c0cc73598591ce2daf
MD5 0cc0a03e392008f274d5e0ae6278bdb0
BLAKE2b-256 5dc8b406dd80b4915174e2d646d8da585f947572badad293d9f44863b5d97598

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