You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Altough my experiments with the WS2812 leds and python2 are successful, I fail to integrate both. Maybe someone with a bit more python knowledge (mine is really low) could help here.
Right now I am using this libary and the examples for python of this GithHub repo work nicely, also my own examples based on these:
import time
from rpi_ws281x import PixelStrip, Color
LED_COUNT = 12 # Number of LED pixels.
LED_PIN = 18 # GPIO pin connected to the pixels (18 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 = 255 # 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
# Define functions which animate LEDs in various ways.
def color(strip, color, wait_ms=50):
"""Wipe color across display a pixel at a time."""
for i in range(strip.numPixels()):
strip.setPixelColor(i, color)
strip.show()
time.sleep(wait_ms / 1000.0)
# Main program logic follows:
if __name__ == '__main__':
strip = PixelStrip(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
strip.begin()
color(strip, Color(255, 0, 0)) # Red wipe
strip.show()
I've been trying to integrate it into user_interface.py (also I hacked the startup script as the led driver requires sudo, so the photobooth.sh script now does a sudo python), but I get a weird error telling me that strip.setSetPixelColor is being called with 4 arguments. I am only passing three, I am assuming that "self" from the python class system somehow gets passed. Problem is, it's a method from the pixel library, so how can I call it with only the three variables?
Sorry, I realize it is a bit confusing. Maybe someone could let me know what would be the best place to initialize the LED strip and then call the led strip functions. Ideally I want to start the led strip if someone has clicked the single/multiple/animation buttons and then turn it off again after the pics are taken.
Thx to all, this is a great project. It saved me a ton of time...
The text was updated successfully, but these errors were encountered:
Altough my experiments with the WS2812 leds and python2 are successful, I fail to integrate both.
Hello Hansaman... Did you succeeded integrating the led as a flash ? Anyone else ? I'm seriously planning to do my own photobooth with flash, and a raspberry 4...
Hi all,
I've been trying to integrate with the Ringlicht - it's a little board that has 12 WS2812 LEDs - perfect for lighting up the scene before a shot.
https://github.com/watterott/RPi-Camera-RingLicht
Altough my experiments with the WS2812 leds and python2 are successful, I fail to integrate both. Maybe someone with a bit more python knowledge (mine is really low) could help here.
Right now I am using this libary and the examples for python of this GithHub repo work nicely, also my own examples based on these:
https://github.com/rpi-ws281x
My example code alone looks similar to this:
import time
from rpi_ws281x import PixelStrip, Color
I've been trying to integrate it into user_interface.py (also I hacked the startup script as the led driver requires sudo, so the photobooth.sh script now does a sudo python), but I get a weird error telling me that strip.setSetPixelColor is being called with 4 arguments. I am only passing three, I am assuming that "self" from the python class system somehow gets passed. Problem is, it's a method from the pixel library, so how can I call it with only the three variables?
Sorry, I realize it is a bit confusing. Maybe someone could let me know what would be the best place to initialize the LED strip and then call the led strip functions. Ideally I want to start the led strip if someone has clicked the single/multiple/animation buttons and then turn it off again after the pics are taken.
Thx to all, this is a great project. It saved me a ton of time...
The text was updated successfully, but these errors were encountered: