Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RGBLED color list cycling #1006

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

RGBLED color list cycling #1006

wants to merge 3 commits into from

Conversation

AnnoNuem
Copy link

Make the RGBLED fade from a color of a list to the next color of the list. Fades over all colors and back to the first color of the list. Uses colorzero to compute the gradient between two colors of the list.

A new _cycle_device function handles the repeated cycling and is also called by the old _blink_device function.

@lurch
Copy link
Contributor

lurch commented Nov 25, 2021

Kind of a duplicate of #1003 ?

@AnnoNuem
Copy link
Author

Similar yes. But the idea here is to cycle over several colors and not only fade between two colors. E.g. we can cycle over all colors by calling the function with red, green and blue.

This could also be extented to the blink method to blink in different colors.

@lurch
Copy link
Contributor

lurch commented Nov 25, 2021

https://github.com/gpiozero/gpiozero/pull/1003/files also adds a cycle_color method.
Perhaps yourself and @tinitaet would like to collaborate on a common solution, rather than creating conflicting PRs? 🙂

@tinitaet
Copy link

@AnnoNuem I am open for a collaboration. We could share some approaches and probably find some common ground.

@AnnoNuem
Copy link
Author

@tinitaet

I think I will not have any time for more coding for this project. However, I will take time for questions and discussion.

My idea was a more flexible approach: A parser which can interpret an arbitrary amount of colors, durations and transitions similar to a sheet of music. The existing functions would then become sheets of color objects which can be given to the parser. Each sheet object would contain color objects, and speed and repetition information. Each color object would contain color, duration and transition information. I also dreamed of midi compatibility and being able to parse midi files or instrument as color.

I hope I was at least able to give you some inspiration.

@tinitaet
Copy link

@AnnoNuem
This actually sounds like a very cool idea. The basic question one hast to ask is, of this should be a part of the gpiozero module of if this would rather profit from being its own module, that uses gpiozero. By doing this, one could write their own wrapper, data format and stuff for the mentioned midi-compatibility and other things, without bloating gpiozero. If you are still interested, you or I could open an new project here on github to get this started!
To be honest this immediately sparked some ideas, since a friend of mine composed a couple of songs for my role-playing-group in midi and it would be sick to see them light up the room!

@AnnoNuem
Copy link
Author

Personally I would prefer to keep it all in gpiozero, but if additional libraries for midi support are required, then possible another project makes sense. But that depends also on the other contributors of gpiozero. If you want to start right away creating a new project is probably the faster way.
As I said before I will not have time for coding, hence it would be better if you create a new project.
Also: I did not thoroughly check whether similar projects exist already...

@lurch
Copy link
Contributor

lurch commented Jan 13, 2022

Just IMHO, but a "sheets of color" functionality sounds perhaps like something a bit too complex for a basic "RGBLED" class?
Of course @bennuttall and @waveform80 might disagree, and their opinion is more important than mine.

Perhaps the https://gpiozero.readthedocs.io/en/stable/source_values.html would be a good way for a 3rd-party project to connect a midi-parser into the rest of the GPIO Zero framework? 🤷

@lurch
Copy link
Contributor

lurch commented Jan 13, 2022

a friend of mine composed a couple of songs for my role-playing-group in midi and it would be sick to see them light up the room!

Reminds me of https://www.raspberrypi.com/news/this-piano-controls-an-led-rainbow-with-raspberry-pi-zero/ 😀

@AnnoNuem
Copy link
Author

@tinitaet Just wondering: Did you made a decision already? Did you start a new project?

@tinitaet
Copy link

@AnnoNuem not yet. Unfortunately I am also a bit busy at the moment.

@NBoumakis
Copy link

I was thinking of developing something similar, a library that can parse some set of instructions and display patterns on various types of LEDs, e.g. a simple LED or a WS2812 matrix. I agree that it would be too complex for this library. Perhaps we can agree on some type of protocol that allows intercommunication.

Is anyone interested in a collaboration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants