| Electronic Components Datasheet Search |
|
WS2812 Datasheet(PDF) 57 Page - Raspberry Pi Holdings PLC |
|
|
|||||||||||||||||||||||||||||
WS2812 Datasheet(HTML) 57 Page - Raspberry Pi Holdings PLC |
|
57 / 98 page ![]() strip.setPixelColor(n, color); Here, color is a 32-bit type that merges the red, green and blue values into a single number. This is sometimes easier or faster for some (but not all) programs to work with; you’ll see the strandtest code uses both syntaxes in different places. You can also convert separate red, green and blue values into a single 32-bit type for later use: uint32_t magenta = strip.Color(255, 0, 255); Then later you can just pass “magenta” as an argument to setPixelColor rather than the separate red, green and blue numbers every time. You can also (optionally) add a white component to the color at the end, like this: uint32_t greenishwhite = strip.Color(0, 64, 0, 64); setPixelColor() does not have an immediate effect on the LEDs. To “push” the color data to the strip, callshow(): strip.show(); This updates the whole strip at once, and despite the extra step is actually a good thing. If every call to setPixelColor() had an immediate effect, animation would appear jumpy rather than buttery smooth. Multiple pixels can be set to the same color using the fill() function, which accepts one to three arguments. Typically it’s called like this: strip.fill(color, first, count); “color” is a packed 32-bit RGB (or RGBW) color value, as might be returned by strip.Color(). There is no option here for separate red, green and blue, so call the Color() function to pack these into one value. “first” is the index of the first pixel to fill, where 0 is the first pixel in the strip, and strip.numPixels() - 1 is the last. Must be a positive value or 0. “count” is the number of pixels to fill. Must be a positive value. If called without a count argument (only color and first), this will from first to the end of the strip. If called without first or count arguments (only color), the full strip will be set to the requested color. If called with no arguments, the strip will be filled with black or “off,” but there’s also a different syntax which might be easier to read: strip.clear(); You can query the color of a previously-set pixel using getPixelColor(): © Adafruit Industries https://learn.adafruit.com/adafruit-neopixel-uberguide Page 60 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 |