Closed Resseguie closed 9 years ago
RGBClass methods:
control(true)
could be mapped pinMode(255, OUTPUT)
control(false)
could be mapped pinMode(255, INPUT)
? Not surecolor(r, g, b)
could be mapped to analogWrite(???)
? Not surebrightness(0-100)
no thoughts yet.This is really messy.
I wonder how they actually handle brightness, since just dimming it can actually change the color if you aren't careful. I'll have to re-load the standard firmware and test it.
(That's exactly why I took it out of Johnny-Five's Led.RGB class for now until I figure out the best way to calculate it.)
I wonder how they actually handle brightness, since just dimming it can actually change the color if you aren't careful. I'll have to re-load the standard firmware and test it.
I'm curious to know this as well, unfortunately all signs lead back to LED_SetBrightness
which apparently has no definition anywhere in that repo :(
Based on your tweet we could start simple by mapping board.digitalWrite(255, 1|0)
to on and off
@Resseguie thanks for the link, I didn't see this ticket. Brightness may be handled just lowering the numbers of red green and blue proportionally.
rgb(255,255,255) => white (1/full bright)
rgb(128,128,128) => grey (0.5/half bright)
rgb(0,0,0) => black (0/null bright)
rgb(255,0,0)=>bright red (1/full bright)
rgb(128,0,0)=>dark red (0.5/half bright)
rgb(0,0,0) => black (0/null bright)
And so on
I don't know if it is the best implementation, but the quickest I found to get to the point. I posted a pull request.
I have tested through the spark-io library and worked for me
I selected the first byte arbitrarily. But i saw there was a gap defined in the array of first bytes. Does it have any special reason?
@canda reducing brightness by lowering RGB values proportionally "kinda" works. Those examples you provided are for pure colors. The difficulty is in mixed values.
@Resseguie you need multiply each color value by a factor Lets say you have this strange brown color
rgb(190,155,123) => http://www.color-hex.com/color/be9b7b
And you want to make it 52% darker, then the factor would be 0.48 190 x 0.48 = 91 155 x 0.48 = 74 123 x 0.48 = 59
so we got a darker shade of the same brown
rgb(91,74,59) => http://www.color-hex.com/color/5b4a3b
Fixed by #40 and related spark-io additions.
I'd like to be able to control the main RGB on the Spark. The Spark core firmware provides an RGB class for this but it doesn't seem to be mapped to a pin.
Could we assign a special pin address (255?) that is mapped to the RGB behind the scenes in voodoospark?
My use case: I just want to be able to turn it off once I connect using spark-io because I'm physically embedding the Spark with a standard RGB inside a little light (think mood light) and the flashing cyan overpowers the colors I'm setting.