| Electronic Components Datasheet Search |
|
WS2812 Datasheet(PDF) 59 Page - Raspberry Pi Holdings PLC |
|
|
|||||||||||||||||||||||||||||
WS2812 Datasheet(HTML) 59 Page - Raspberry Pi Holdings PLC |
|
59 / 98 page ![]() setPixelColor() and fill() both still want RGB values though, so we convert to these from HSV by using the ColorHSV() function: uint32_t rgbcolor = strip.ColorHSV(hue, saturation, value); If you just want a “pure color” (fully saturated and full brightness), the latter two arguments can be left off: uint32_t rgbcolor = strip.ColorHSV(hue); In either case, the resulting RGB value can then be passed to a pixel-setting function, e.g.: strip.fill(rgbcolor); There is no corresponding function to go the other way, from RGB to HSV. This is on purpose and by design, because conversion in that direction is often ambiguous — there may be multiple valid possibilities for a given input. If you look at some of the example sketches you’ll see they keep track of their own hues…they don’t assign colors to pixels and then try to read them back out again. …and Gamma Correction Something you might observe when working with more nuanced color changes is that things may appear overly bright or washed-out. It’s generally not a problem with simple primary and secondary colors, but becomes more an issue with blends, transitions, and the sorts of pastel colors you might get from the ColorHSV() function. Numerically the color values are correct, but perceptually our eyes make something different of it, as explained in this guide (https://adafru.it/w2B). The gamma32() function takes a packed RGB value (as you might get out of Color() or ColorHSV()) and filters the result to look more perceptually correct. uint32_t rgbcolor = strip.gamma32(strip.ColorHSV(hue, sat, val)); You might notice in strandtest and other example sketches that we never use ColorHSV() without passing the result through gamma32() before setting a pixel’s color. It’s that desirable. However, the gamma32 operation is not built in to ColorHSV() — it must be called as a separate operation — for a few reasons, including that advanced programmers might want to provide a more specific color-correction function of their own design (gamma32() is a “one size fits most” approximation) or may need to keep around the original “numerically but not perceptually correct” numbers. There is no corresponding reverse operation. When you set a pixel to a color filtered through gamma32(), reading back the pixel value yields that filtered color, not the original RGB value. It’s precisely because of this sort of decimation that advanced NeoPixel programs often treat the pixel buffer as a write-only resource…they generate each full frame of animation based on their own program state, not as a series of read-modify-write operations. Help! I’m calling setPixel() but nothing’s happening! © Adafruit Industries https://learn.adafruit.com/adafruit-neopixel-uberguide Page 62 of 101 |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |