??? 06/09/10 07:19 Read: times Msg Score: +1 +1 Good Answer/Helpful |
#176545 - Still never telling what you do want Responding to: ???'s previous message |
Still never telling what you do want. All you do is either ignoring posts, or telling that they are not what you want but not giving any indication exactly what you want.
Going from black to white without steping through "colors", just means that you should select the alternatives R: 0, G: 0, B: 0 R: 1, G: 1, B: 1 R: 2, G: 2, B: 2 R: 3, G: 3, B: 3 R: 4, G: 4, B: 4 To control the color temperature of the white, you may then have to let your PWM (or external serial resistors or similar) control the exact balance between the three color channels - if you want bluish white or redish white or a reasonably neutral white. I can't remember that you have told us why you want a combined 8-bit color index? Is that because you want to be able to store a number of color choices somewhere and only want to consume one byte for each color choice? Your PWM code (or whatever you are using for controlling the intensity of the color channels) does not need any combined index. At most, it needs a single table storing a precomputed/measured PWM value for each intensity. If the three colors behaves different, then you would need 3 5-entry tables. You never need a 125-element table as long as your colors are formed from 5 steps of red, 5 steps of green and 5 steps of blue. If you do need to store the color in a byte, you can do: red = idx % 5. green = (idx / 5) % 5 blue = idx / 25 or optionally (idx / 25) % 5 to handle invalid index values >= 125. You are good at writing "I don't want ...", but very bad at explaining what you want. You may say "I can't control the colors" but not what problem you have. What result you get and - more importantly - what result you expected. So if you don't want smooth transitions between two colors - exactly what do you want? Black is trivial. White is almost trivial (you need to decide what color temperature you want and individually adjust the amount of red, green and blue to get warm or cold white, and you need to decide what intensity you want). But unless you have specific requirements of controllable color temperature, you don't need any RGB - you can select a white LED of suitable color temperature. So exactly what do you want to happen between black and white? Another thing. You say you still don't know what HSV is. Have you looked at the wiki link I have posted? HSV is Hue, Saturation, Value. It's a way to describe a color by specifying which pure color (similar to wavelength or position in rainbow), and specifying how much white that is added with the pure color, and specifying how strong color + white is. So you specify if you want red, magenta, yellow, ... And you specify if you want light red (much white added to the red) or dark red (almost pure red without addition of white component) and you specify if you want much light or little, i.e. if the LEDs should light up the room or just glow dimly. Open most paint programs. You will find that they allow you to select colors either by selecting red, green and blue individually. Or by showing a color circle where the outside have the pure colors, rotating between red, green and blue, and the center is some form of white or gray. The paint programs then have a separate slider switching between black and full intensity. With R+G+B you have a hard time changing from one green to a slightly different shade of green. With the HSV color space, you will see different greens as neighbours, allowing you to better match the intended shade of green. In the same way, HSV is much better when gradually changing from one color (H,S,V triple) to another color (H,S,V triple). The middle color between two RGB triplets is not as beautiful. |