Giter Club home page Giter Club logo

Comments (2)

knorth55 avatar knorth55 commented on July 28, 2024

sample program
https://github.com/jgarff/rpi_ws281x
https://github.com/rpi-ws281x/rpi-ws281x-python

led
https://gist.github.com/knorth55/e7eda28fb1a185b2070a8c982fe5b6eb

IMPORTANT:
https://github.com/jgarff/rpi_ws281x#spi

from rmui.

knorth55 avatar knorth55 commented on July 28, 2024
import time

from rpi_ws281x import Color
from rpi_ws281x import PixelStrip


# LED strip configuration:
LED_COUNT = 1        # Number of LED pixels.
# LED_PIN = 12          # GPIO pin connected to the pixels (12 uses PWM!).
LED_PIN = 10        # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0).
LED_FREQ_HZ = 800000  # LED signal frequency in hertz (usually 800khz)
LED_DMA = 10          # DMA channel to use for generating signal (try 10)
LED_BRIGHTNESS = 127  # Set to 0 for darkest and 255 for brightest
LED_INVERT = False    # True to invert the signal (when using NPN transistor level shift)
LED_CHANNEL = 0       # set to '1' for GPIOs 13, 19, 41, 45 or 53



def colorWipe(strip, color, wait_second):
    """Wipe color across display a pixel at a time."""
    for i in range(strip.numPixels()):
        strip.setPixelColor(i, color)
        strip.show()
        time.sleep(wait_second)


def main():
    strip = PixelStrip(
        LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA,
        LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
    strip.begin()
    
    try:
        while True:
            colorWipe(strip, Color(255, 0, 0), 0.5)  # Red wipe
            colorWipe(strip, Color(0, 255, 0), 0.5)  # Blue wipe
            colorWipe(strip, Color(0, 0, 255), 0.5)  # Green wipe
    except KeyboardInterrupt:
        colorWipe(strip, Color(0, 0, 0), 0.01)


if __name__ == '__main__':
    main()

LED can be used with this program!

from rmui.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.