I was playing around with the RGB LED (sorry if that's not what it's called, it's the single LED that can do Blue/Green/Red) and was wondering if it's possible to use one
potentiometer to "run the gamut" of colors (ie, run through all the colors possible)?
I have found a couple of sites (such as this one
) that can do this, but using three potentiometers, but was wondering what the math would be to "wrap it into one"?
I can see it in my head, but can't figure out a way to do it programatically. Is there a way to change the colors that doesn't use RGB?
Hm, just thinking about it I could maybe do like
// psuedo code (or mainly general thoughts):
color = [0, 0, 0] //I'm thinking this can be an array, so I can change color, color, and color individually
chgColor = map(potentiometer reading, 0, 1023, 0, 255)
if color < 255, then keep color and color 0
But if color= 255, then move on to color and start from 0 and go to 255 as the colors go up...
Then when color and color are 255, start on color
...does that even make sense?
Thanks for any thoughts!
edit: I know there's an LED section, but figured this is more of a programming question than issue with LED, but mods feel free to move the post to the other area if you think it's more appropriate there.