Alternate Color Patterns

Hi all - I have been reviewing all of the code associated with the Alexa and Google Home color patterns and trying to figure out the dang logic behind the patterns. I want to create a new pattern specific to my project with specific colors and sweeping patterns but the code is overwhelming to me.



for examples see: <LINK_TEXT text=“https://github.com/respeaker/4mics_hat/ … pattern.py”>https://github.com/respeaker/4mics_hat/blob/master/alexa_led_pattern.py</LINK_TEXT>



Does anyone know a simpler method to call the LED’s, set the colors, and set the timing?



Thanks,

Stephan

HI Stephan,



please use below code. thanks.

[code]
import time

from pixel_ring import pixel_ring
from gpiozero import LED

power = LED(5)
power.on()

pixel_ring.set_brightness(10)

pixel_ring.set_color(0,255,0)
time.sleep(3)
pixel_ring.off()
power.off()
[/code]

Thanks for this, but it fails because I don’t seem to have the respeaker.usb_hid installed properly?

Hi Stephan,


  1. do you use the 4 mics pi hat?


  2. what kinds of error do you have?


  3. do you open the spi interface as below?

    sudo raspi-config

    Go to “Interfacing Options”

    Go to “SPI”

    Enable SPI

    Exit the tool


  4. we use the pixel library from <LINK_TEXT text=“https://github.com/respeaker/pixel_ring … pixel_ring”>https://github.com/respeaker/pixel_ring/tree/master/pixel_ring</LINK_TEXT> thanks.

Thanks for the above, but I searched around and was able to reinstall usb_hid and it now works.



I now just need to figure out how to do patterns. The above code seems to turn them all on or all off. That is a start.