Page 1 of 1

Alternate Color Patterns

Posted: Tue Nov 13, 2018 12:57 pm
by stephan679
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: https://github.com/respeaker/4mics_hat/ ... pattern.py

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

Thanks,
Stephan

Re: Alternate Color Patterns

Posted: Thu Nov 29, 2018 4:20 pm
by bill.yu
HI Stephan,

please use below code. thanks.

Code: Select all

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

Re: Alternate Color Patterns

Posted: Thu Jan 31, 2019 12:59 pm
by stephan679
Thanks for this, but it fails because I don't seem to have the respeaker.usb_hid installed properly?

Re: Alternate Color Patterns

Posted: Fri Feb 01, 2019 5:48 pm
by bill.yu
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 https://github.com/respeaker/pixel_ring ... pixel_ring thanks.

Re: Alternate Color Patterns

Posted: Wed Feb 06, 2019 10:49 am
by stephan679
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.