### DotStarSpi40MhzMethod Example (Hardware SPI, 40MHz) Source: https://github.com/makuna/neopixelbus/wiki/DotStar-Methods Example of using DotStarSpi40MhzMethod for generic DotStar LEDs on hardware SPI at a very high speed. Ensure LED compatibility with 40MHz operation. ```c++ DotStarSpi40MhzMethod ``` -------------------------------- ### P9813SpiHzMethod Example (Hardware SPI, Runtime Speed) Source: https://github.com/makuna/neopixelbus/wiki/DotStar-Methods Example of using P9813SpiHzMethod for P9813 LEDs on hardware SPI, allowing the speed to be set at runtime. Use strip.SetMethodSettings() to configure. ```c++ P9813SpiHzMethod ``` -------------------------------- ### WS2812x NeoPixelBus Initialization Source: https://github.com/makuna/neopixelbus/wiki/NeoPixelBus-object Example for initializing a NeoPixelBus for 16 WS2812x pixels on pin 2, using GRB color order. This is a common setup for many platforms. ```csharp NeoPixelBus strip(16, 2); ``` -------------------------------- ### RowMajorLayout Example (8x8) Source: https://github.com/makuna/neopixelbus/wiki/NeoTopology-object Illustrates the pixel indexing for an 8x8 matrix using RowMajorLayout. ```text 0 1 2 3 4 5 6 7 ------------------------------------------------------------------ 0 | 0 1 2 3 4 5 6 7 1 | 8 9 10 11 12 13 14 15 2 | 16 17 18 19 20 21 22 23 3 | 24 25 26 27 28 29 30 31 4 | 32 33 34 35 36 37 38 39 5 | 40 41 42 43 44 45 46 47 6 | 48 49 50 51 52 53 54 55 7 | 56 57 58 59 60 61 62 63 ``` -------------------------------- ### Start Animation with Callback Source: https://github.com/makuna/neopixelbus/wiki/NeoPixelAnimator-object-API Starts an animation on a specified channel with a given duration and an update callback function. If an animation is already running on the channel, it will be stopped and replaced. ```c++ void StartAnimation(uint16_t indexAnimation, uint16_t duration, AnimUpdateCallback animUpdate) ``` -------------------------------- ### Ws2801Spi2MhzMethod Example (Hardware SPI, 2MHz) Source: https://github.com/makuna/neopixelbus/wiki/DotStar-Methods Example of using Ws2801Spi2MhzMethod for WS2801 LEDs on hardware SPI at a slow speed. This is suitable for potentially noisy signal wires. ```c++ Ws2801Spi2MhzMethod ``` -------------------------------- ### ColumnMajorAlternatingLayout Example (8x8) Source: https://github.com/makuna/neopixelbus/wiki/NeoTopology-object Illustrates the pixel indexing for an 8x8 matrix using ColumnMajorAlternatingLayout. ```text 0 1 2 3 4 5 6 7 ------------------------------------------------------------------ 0 | 0 15 16 31 32 47 48 63 1 | 1 14 17 30 33 46 49 62 2 | 2 13 18 29 34 45 50 61 3 | 3 12 19 28 35 44 51 60 4 | 4 11 20 27 36 43 52 59 5 | 5 10 21 26 37 42 53 58 6 | 6 9 22 25 38 41 54 57 7 | 7 8 23 24 39 40 55 56 ``` -------------------------------- ### NeoPixelSegmentBus Constructor Example Source: https://github.com/makuna/neopixelbus/wiki/NeoPixelSegmentBus-object-API Instantiates a NeoPixelSegmentBus object. Requires template arguments for color features and method, and constructor arguments for the number of pixels and the data pin. ```cpp NeoPixelSegmentBus strip(DigitCount, BusPin); ``` -------------------------------- ### RowMajorAlternatingLayout Example (8x8) Source: https://github.com/makuna/neopixelbus/wiki/NeoTopology-object Illustrates the pixel indexing for an 8x8 matrix using RowMajorAlternatingLayout. ```text 0 1 2 3 4 5 6 7 ------------------------------------------------------------------ 0 | 0 1 2 3 4 5 6 7 1 | 15 14 13 12 11 10 9 8 2 | 16 17 18 19 20 21 22 23 3 | 31 30 29 28 27 26 25 24 4 | 32 33 34 35 36 37 38 39 5 | 47 46 45 44 43 42 41 40 6 | 48 49 50 51 52 53 54 55 7 | 63 62 61 60 59 58 57 56 ``` -------------------------------- ### HslColor Conversion Example Source: https://github.com/makuna/neopixelbus/wiki/Color-objects Demonstrates how to convert a Hue value from a 0-360 range to the library's supported 0-1.0 range when creating an HslColor object. ```C++ HslColor color(hueValue / 360.0f, saturationValue, lightnessValue); ``` -------------------------------- ### StartAnimation Source: https://github.com/makuna/neopixelbus/wiki/NeoPixelAnimator-object-API Starts a new animation on a specified channel with a given duration and an update callback. ```APIDOC ## void StartAnimation(uint16_t indexAnimation, uint16_t duration, AnimUpdateCallback animUpdate) ### Description Start an animation at the given index, set the length in time to duration, and provide an update callback that applies the effect. If there is an active animation on the channel, it will be stopped first. ### Parameters - **indexAnimation** (uint16_t): The animation channel to use. If there is an active animation on that channel, it will be stopped first and then the channel will be reused. - **duration** (uint16_t): The length of time the animation will run. The scale is based on the flags passed to the constructor of this manager class. - **animUpdate** (AnimUpdateCallback): The callback function that will be called for every passage of time. ``` -------------------------------- ### HslColor Linear Blend Example Source: https://github.com/makuna/neopixelbus/wiki/HslColor-object-API Demonstrates how to blend between two HslColor objects using the static LinearBlend method. Specify the blend type (e.g., NeoHueBlendShortestDistance), the start and end colors, and the progress of the blend. ```c++ HslColor results = HslColor::LinearBlend(HslColor(0.88f,1.0f,0.5f), HslColor(0.12f,1.0f,0.5f), 0.33f); ``` -------------------------------- ### Render External NeoDib Buffer to NeoPixelBusLg Source: https://github.com/makuna/neopixelbus/wiki/NeoPixelBusLg-object-API This example demonstrates how to render an external NeoDib buffer into a NeoPixelBusLg strip using the strip's defined luminance and gamma correction. Ensure the NeoDib and NeoPixelBusLg are initialized with compatible features and methods. ```cpp typedef NeoPixelBusLg MyBusType; MyBusType strip(PixelCount, PixelPin); NeoDib image(PixelCount); ... image.Render(strip, strip.Shader); ``` -------------------------------- ### Rendering a 4x4 Block to NeoPixelBus Source: https://github.com/makuna/neopixelbus/wiki/NeoBitmapFile-object Shows how to use the Blt method to render a specific portion of a NeoBitmapFile to a NeoPixelBus. This example renders the first 4x4 block of pixels from the image to the strip starting at location (4,4), using a custom layout map. ```c++ image.Blt(strip, 4, 4, 0, 0, 4, 4, LayoutMap); ``` -------------------------------- ### Tlc5947Spi15MhzMethod Example (Hardware SPI, 15MHz) Source: https://github.com/makuna/neopixelbus/wiki/DotStar-Methods Example of using Tlc5947Spi15MhzMethod for TLC5947 LEDs at its default low normal speed of 15MHz. This is suitable for cascaded LEDs. ```c++ Tlc5947Spi15MhzMethod ``` -------------------------------- ### Non-Blocking Loop for NeoPixelBus and Other Tasks Source: https://github.com/makuna/neopixelbus/wiki/FAQ- This example shows a typical loop() structure that allows for other important tasks to run concurrently with NeoPixelBus operations. Avoid calls to delay() to maintain NeoPixel refresh rates. ```c++ void loop() { // any other code that needs to be run often // avoid calls to delay() as it will slow down your NeoPixel refresh rate animator.UpdateAnimations(); // if you don't have animations in your sketch, you can omit this line strip.Show(); } ``` -------------------------------- ### RowMajorLayout Example Source: https://github.com/makuna/neopixelbus/wiki/NeoMosaic-object Shows the pixel indexing for a 4x4 panel matrix with 2x2 tiles using the RowMajorLayout. This layout is helpful for understanding how rows are processed and indexed. ```text 0 1 2 3 4 5 6 7 ------------------------------------------------------------------- 0 | 0< 1 2 3 19 23 27 31> 1 | 4 5 6 7 18 22 26 30 2 | 8 9 10 11 17 21 25 29 3 | 12 13 14 15> 16< 20 24 28 4 | 60 56 52 48< 47> 46 45 44 5 | 61 57 53 49 43 42 41 40 6 | 62 58 54 50 39 38 37 36 7 | 63> 59 55 51 35 34 33 32< ``` -------------------------------- ### Convert RgbwColor to RgbColor by Blending White Source: https://github.com/makuna/neopixelbus/wiki/FAQ- This example shows how to blend the white component of an RgbwColor into the R, G, and B values to create an RgbColor. This method attempts to preserve more of the original color information. ```C++ RgbwColor myColor(124, 64, 124, 10); RgbColor myRgbColor(myColor.R + myColor.W, myColor.G + myColor.W, myColor.B + myColor.W); // blend in white ``` -------------------------------- ### Implement Custom Layout Map Callback Source: https://github.com/makuna/neopixelbus/wiki/NeoBuffer-object-API An example of implementing a custom LayoutMapCallback function. This function translates 2D coordinates (x, y) to a linear pixel index, often used with NeoTopology for mapping pixel locations on matrix panels. ```cpp NeoTopology topo(16,16); // 16x16 matrix panel uint16_t MyLayoutMap(int16_t x, int16_t y) { return topo.MapProbe(x, y); } ``` -------------------------------- ### NeoSpiralTopology Initialization Example Source: https://github.com/makuna/neopixelbus/wiki/Spiral-Topography Example of how to initialize the NeoSpiralTopology class with a specific configuration of rings. The Rings array defines the starting pixel index for each ring, including an extra value for calculations. ```cpp const uint16_t Rings[] = {0, 1, 7, 19, 35, 59, 119}; // required, include the start of another ring NeoSpiralTopology topo(Rings, sizeof(Rings) / sizeof(Rings[0])); ``` -------------------------------- ### Begin Method Source: https://github.com/makuna/neopixelbus/wiki/NeoBitmapFile-object-API Initializes the NeoBitmapFile to use a given file, validating its format. It returns false if the file is not a compatible BMP (24 or 32 bit, no compression). The provided file instance is managed by NeoBitmapFile. ```APIDOC ## bool Begin(FILE file) ### Description Initializes the NeoBitmapFile to use the given file. It checks the file's contents for a valid image and configures itself to read data from it. Returns false if the file is not a compatible format (currently requires BMP, 24 or 32 bit, with no compression). The `file` instance passed in will be managed by the NeoBitmapFile object, so there is no need to close it manually. ### Parameters #### Path Parameters - **file** (FILE) - Required - The file object to initialize the NeoBitmapFile with. ``` -------------------------------- ### Instantiating NeoTiles and Setting Pixel Color Source: https://github.com/makuna/neopixelbus/wiki/NeoTiles-object Demonstrates how to instantiate the NeoTiles object with specific layouts and then use it to set a pixel's color on the NeoPixelBus strip. ```cpp NeoPixelBus strip(PixelCount, PixelPin); NeoTiles tiles( PanelWidth, PanelHeight, TileWidth, TileHeight); ... strip.SetPixelColor(tiles.Map(4, 5), RgbColor(16,16,98)); ``` -------------------------------- ### Constructing NeoBitmapFile with Matching ColorFeature Source: https://github.com/makuna/neopixelbus/wiki/NeoBitmapFile-object Demonstrates how to construct a NeoBitmapFile object, ensuring the ColorFeature matches that of the NeoPixelBus. This is crucial for correct data storage and referencing. ```c++ NeoPixelBus strip(PixelCount, PixelPin); NeoBitmapFile image; ``` -------------------------------- ### Initializing NeoBuffer from PROGMEM Source: https://github.com/makuna/neopixelbus/wiki/NeoBuffer-object Shows two ways to construct a NeoBuffer: one stored in RAM but initialized from PROGMEM, and another stored directly in PROGMEM for memory efficiency. ```c++ // stored in RAM, but initialized by the "myImage" from PROGMEM NeoBuffer> image(myImageWidth, myImageHeight, myImage); // stored in PROGMEM NeoBuffer> image(myImageWidth, myImageHeight, myImage); ``` -------------------------------- ### Set SM16803PB Pixel Power Settings Source: https://github.com/makuna/neopixelbus/wiki/Neo-Features Configure power usage for SM16803PB LEDs after calling Begin(). Arguments are indexes into a table of 1/10th milliamps. ```cpp strip.SetPixelSettings(NeoSm16803pbSettings(12,12,12)); // 16.8ma ``` -------------------------------- ### Constructing NeoVerticalSpriteSheet with RAM or PROGMEM Source: https://github.com/makuna/neopixelbus/wiki/NeoVerticalSpriteSheet-object Demonstrates constructing a NeoVerticalSpriteSheet using either RAM (NeoBufferMethod) or PROGMEM (NeoBufferProgmemMethod). Choose RAM for dynamic modification and PROGMEM for static images to save RAM. ```c++ // stored in RAM, but initialized by the "myImage" from PROGMEM NeoVerticalSpriteSheet> spriteSheet(myImageWidth, myImageHeight, 8, myImage); // stored in PROGMEM NeoVerticalSpriteSheet> spriteSheet(myImageWidth, myImageHeight, 8, myImage); ``` -------------------------------- ### RgbwwColor Constructor with HsbColor Source: https://github.com/makuna/neopixelbus/wiki/RgbwwColor-object-API Constructs an RgbwwColor from an HsbColor, converting HSB to RGBW. ```cpp RgbwwColor(HsbColor color); ``` -------------------------------- ### Get Current Time Scale Source: https://github.com/makuna/neopixelbus/wiki/NeoPixelAnimator-object-API Retrieves the current time scale value used by the animator. ```c++ uint16_t getTimeScale() ``` -------------------------------- ### Blt (Linear Rendering) Source: https://github.com/makuna/neopixelbus/wiki/NeoBuffer-object-API Renders this image linearly to a destination buffer starting at a specified pixel index. ```APIDOC ## Blt (Linear Rendering) ### void Blt(NeoBufferContext destBuffer, uint16_t indexPixel) #### Description Renders this image linearly to the `destBuffer` starting at `indexPixel`. This is a linear rendering, not a 2D image rendering. #### Parameters * **destBuffer** (NeoBufferContext) - Another NeoBuffer or NeoPixelBus object to render to. * **indexPixel** (uint16_t) - The linear index in the destination buffer to start the render at. ``` -------------------------------- ### Constructing NeoPixelBus and NeoBuffer Source: https://github.com/makuna/neopixelbus/wiki/NeoBuffer-object Demonstrates how to construct a NeoPixelBus and a NeoBuffer, ensuring they share the same NeoGrbwFeature. The NeoBuffer is defined with NeoBufferMethod for RAM storage. ```c++ NeoPixelBus strip(PixelCount, PixelPin); NeoBuffer> image(myImageWidth, myImageHeight, NULL); ``` -------------------------------- ### NeoTiles Layout: ColumnMajorAlternatingLayout, ColumnMajorLayout Source: https://github.com/makuna/neopixelbus/wiki/NeoTiles-object Example pixel index mapping for a NeoTiles object configured with ColumnMajorAlternatingLayout and ColumnMajorLayout. ```text 0 1 2 3 4 5 6 7 ------------------------------------------------------------------- 0 | 0< 7 8 15> 32< 39 40 47> 1 | 1 6 9 14 33 38 41 46 2 | 2 5 10 13 34 37 42 45 3 | 3 4 11 12 35 36 43 44 4 | 16< 23 24 31> 48< 55 56 63> 5 | 17 22 25 30 49 54 57 62 6 | 18 21 26 29 50 53 58 61 7 | 19 20 27 28 51 52 59 60 ``` -------------------------------- ### NeoTiles Layout: RowMajorAlternatingLayout, RowMajorAlternatingLayout Source: https://github.com/makuna/neopixelbus/wiki/NeoTiles-object Example pixel index mapping for a NeoTiles object configured with RowMajorAlternatingLayout and RowMajorAlternatingLayout. ```text 0 1 2 3 4 5 6 7 ------------------------------------------------------------------- 0 | 0< 1 2 3 16< 17 18 19 1 | 7 6 5 4 23 22 21 20 2 | 8 9 10 11 24 25 26 27 3 | 15> 14 13 12 31> 30 29 28 4 | 48< 49 50 51 32< 33 34 35 5 | 55 54 53 52 39 38 37 36 6 | 56 57 58 59 40 41 42 43 7 | 63> 62 61 60 47> 46 45 44 ``` -------------------------------- ### NeoTiles Layout: RowMajorAlternatingLayout, ColumnMajorAlternatingLayout Source: https://github.com/makuna/neopixelbus/wiki/NeoTiles-object Example pixel index mapping for a NeoTiles object configured with RowMajorAlternatingLayout and ColumnMajorAlternatingLayout. ```text 0 1 2 3 48< 49 50 51 ------------------------------------------------------------------- 0 | 0< 1 2 3 48< 49 50 51 1 | 7 6 5 4 55 54 53 52 2 | 8 9 10 11 56 57 58 59 3 | 15> 14 13 12 63> 62 61 60 4 | 16< 17 18 19 32< 33 34 35 5 | 23 22 21 20 39 38 37 36 6 | 24 25 26 27 40 41 42 43 7 | 31> 30 29 28 47> 46 45 44 ``` -------------------------------- ### Construct NeoPixelBusLg with Table Gamma Method Source: https://github.com/makuna/neopixelbus/wiki/NeoPixelBusLg-object Instantiate a NeoPixelBusLg object using NeoRgbFeature, NeoWs2812xMethod, and the faster NeoGammaTableMethod for gamma correction. ```cpp NeoPixelBusLg strip(PixelCount, PixelPin); ``` -------------------------------- ### Rgb16Color Property Accessors Source: https://github.com/makuna/neopixelbus/wiki/Rgb16Color-object-API Provides documentation for methods to get and set the Red, Green, and Blue components of an Rgb16Color. ```APIDOC ## void setR(uint8_t r) ### Description Set the red value, encoding it into the single 16 bit value. ### Parameters * **r** (uint8_t) - (0-255) ## uint8_t getR() ### Description Get the red value, decoding it from the single 16 bit value ## void setG(uint8_t g) ### Description Set the green value, encoding it into the single 16 bit value. ### Parameters * **g** (uint8_t) - (0-255) ## uint8_t getG() ### Description Get the green value, decoding it from the single 16 bit value ## void setB(uint8_t b) ### Description Set the blue value, encoding it into the single 16 bit value. ### Parameters * **b** (uint8_t) - (0-255) ## uint8_t getB() ### Description Get the blue value, decoding it from the single 16 bit value ``` -------------------------------- ### Instantiate NeoBitmapFile Source: https://github.com/makuna/neopixelbus/wiki/NeoBitmapFile-object-API Defines a NeoBitmapFile object with specified Feature and File types. Ensure FEATURE and FILE types are compatible with NeoPixelBus and File class APIs respectively. ```cpp NeoBitmapFile image; ``` -------------------------------- ### AnimationState Enum Values Source: https://github.com/makuna/neopixelbus/wiki/NeoPixelAnimator-object-API Describes the possible states for an animation: Started, Progress, and Completed. These states inform the animation callback about the current stage of the animation. ```c AnimationState_Started - this is the first call to update, will only be set once unless the animation is restarted. AnimationState_Progress - this is one of the many calls between the first and last. AnimationState_Completed - this is the last call to update, will only be set once unless the animation is restarted. ``` -------------------------------- ### RgbColor LinearBlend Example Source: https://github.com/makuna/neopixelbus/wiki/RgbColor-object-API Blends between two RgbColor objects based on a progress value (0-255). Call this static method scoped to the RgbColor class. ```C++ RgbColor results = RgbColor::LinearBlend(RgbColor(255,0,0), RgbColor(0,255,0), 85); ``` -------------------------------- ### Rgb16Color Constructors Source: https://github.com/makuna/neopixelbus/wiki/Rgb16Color-object-API Provides documentation for various ways to construct an Rgb16Color object. ```APIDOC ## Rgb16Color(uint8_t r, uint8_t g, uint8_t b) ### Description Constructs an Rgb16Color using Red, Green, and Blue color component values. ### Parameters * **r** (uint8_t) - value of Red component (0 - 255) * **g** (uint8_t) - value of Green component (0 - 255) * **b** (uint8_t) - value of Blue component (0 - 255) ## Rgb16Color(uint8_t brightness) ### Description Constructs an Rgb16Color using a single brightness value (0 - 255). This works well for creating gray tone colors. ### Parameters * **_brightness_** (uint8_t) - brightness value where (0) = black, (128) = gray, (255) = white ## Rgb16Color(uint16_t color) ### Description Constructs an Rgb16Color using a single color value encoded in 565 model. ### Parameters * **_color_** (uint16_t) - color encoded in 565 model ## Rgb16Color(RgbColor color) ### Description Constructs an Rgb16Color using RgbColor, encoding the 8 bit elements into the single 565 16 bit value. ### Parameters * **_color_** (RgbColor) - an RgbColor object ## Rgb16Color(HtmlColor color) ### Description Constructs an Rgb16Color using HtmlColor, converting the Html single value to Rgb component values. ### Parameters * **_color_** (HtmlColor) - an HtmlColor object ## Rgb16Color(HslColor color) ### Description Constructs an Rgb16Color using HslColor, converting the Hsl to Rgb. ### Parameters * **_color_** (HslColor) - an HslColor object ## Rgb16Color(HsbColor color) ### Description Constructs an Rgb16Color using HsbColor, converting the Hsb to Rgb. ### Parameters * **_color_** (HsbColor) - an HsbColor object ## Rgb16Color() ### Description Constructs an Rgb16Color that will have its values set in latter operations. CAUTION: The Color565 member is not initialized and may not be consistent until set. ``` -------------------------------- ### Get Animation Duration Source: https://github.com/makuna/neopixelbus/wiki/NeoPixelAnimator-object-API Retrieves the duration of the specified animation channel. The time unit is based on the time scale set during the animator's construction. ```c++ uint16_t AnimationDuration(uint16_t indexAnimation) ``` -------------------------------- ### RgbwColor Constructor with R, G, B, W values Source: https://github.com/makuna/neopixelbus/wiki/RgbwColor-object-API Initializes a RgbwColor object with specified Red, Green, Blue, and White component values. ```cpp RgbwColor(uint8_t r, uint8_t g, uint8_t b, uint8_t w); ``` -------------------------------- ### Rendering a Sprite to a NeoPixelBus Source: https://github.com/makuna/neopixelbus/wiki/NeoVerticalSpriteSheet-object Renders the first sprite (index 0) from the image to the NeoPixelBus starting at coordinates (4,4), using the provided custom layout map. ```c++ image.Blt(strip, 4, 4, 0, LayoutMap); ``` -------------------------------- ### Set SM16804EB Pixel Power Settings Source: https://github.com/makuna/neopixelbus/wiki/Neo-Features Configure power usage for SM16804EB LEDs after calling Begin(). Arguments are indexes into a table of 1/10th milliamps. ```cpp strip.SetPixelSettings(NeoSm16804ebSettings(12,12,12,12)); // 16.8ma ``` -------------------------------- ### Rgbw64Color Constructors Source: https://github.com/makuna/neopixelbus/wiki/Rgbw64Color-object-API Provides various constructors to initialize an Rgbw64Color object. These include constructors that take individual component values, a brightness value, or convert from other color formats like RgbColor, Rgb48Color, RgbwColor, HslColor, and HsbColor. A default constructor is also available. ```APIDOC ## Constructors ### Rgbw64Color(uint16_t r, uint16_t g, uint16_t b, uint16_t w) Constructs a Rgbw64Color using Red, Green, Blue, and White component values. > * _r_ - value for the Red component (0 - 65535) > * _g_ - value for the Green component (0 - 65535) > * _b_ - value for the Blue component (0 - 65535) > * _w_ - value for the White component (0 - 65535) ### Rgbw64Color(uint16_t brightness) Constructs a Rgbw64Color using a single brightness value(0 - 65535). This works well for creating gray tone colors. > * _brightness_ - value for the white component where (0) = black, (21845) = gray, (65535) = white. This will only affect the W color element. ### Rgbw64Color(RgbColor color) Construct a Rgbw64Color using RgbColor, converting the R,G,B values and setting W to zero. > * _color_ - a RgbColor object. ### Rgbw64Color(Rgb48Color color) Construct a Rgbw64Color using Rgb48Color, copying the R,G,B values and setting W to zero. > * _color_ - a Rgb48Color object. ### Rgbw64Color(RgbwColor color) Construct a Rgbw64Color using RgbwColor, converting the R,G,B, and W values. > * _color_ - a RgbwColor object. ### Rgbw64Color(HslColor color) Construct a Rgbw64Color using HslColor, converting the Hsl to Rgbw > * _color_ - a HslColor object. ### Rgbw64Color(HsbColor color) Construct a Rgbw64Color using HsbColor, converting the Hsb to Rgbw > * _color_ - a HsbColor object. ### Rgbw64Color() Construct a Rgbw64Color that will have its values set in latter operations. CAUTION: The R,G,B,W members are not initialized and may not be consistent until set. ``` -------------------------------- ### Mapping 2D Coordinates to Pixel Index Source: https://github.com/makuna/neopixelbus/wiki/NeoTopology-object Instantiate a NeoPixelBus strip and a NeoTopology object, then use the Map method to get the index for setting pixel colors. ```cpp NeoPixelBus strip(PixelCount, PixelPin); NeoTopology topo(PanelWidth, PanelHeight); ... strip.SetPixelColor(topo.Map(4, 5), RgbColor(16,16,98)); ``` -------------------------------- ### Rgb48Color Constructors Source: https://github.com/makuna/neopixelbus/wiki/Rgb48Color-object-API Provides documentation for various ways to construct an Rgb48Color object, including initialization with RGB values, brightness, or conversion from other color types. ```APIDOC ## Rgb48Color(uint16_t r, uint16_t g, uint16_t b) ### Description Constructs a Rgb48Color using Red, Green, and Blue color component values. ### Parameters #### Path Parameters - **r** (uint16_t) - Required - value of Red component (0 - 65535) - **g** (uint16_t) - Required - value of Green component (0 - 65535) - **b** (uint16_t) - Required - value of Blue component (0 - 65535) ## Rgb48Color(uint16_t brightness) ### Description Constructs a Rgb48Color using a single brightness value(0 - 65535). This works well for creating gray tone colors. ### Parameters #### Path Parameters - **brightness** (uint16_t) - Required - brightness value where (0) = black, (32767) = gray, (65535) = white ## _explicit_ Rgb48Color(RgbwColor color) ### Description Construct a Rgb48Color using RgbwColor, converting the R,G,B values and ignoring the W value. Due to the loss of information of the W value, this constructor is marked explicit so it will not automatically be used for conversion. ### Parameters #### Path Parameters - **color** (RgbwColor) - Required - a RgbwColor object. ## _explicit_ Rgb48Color(Rgbw64Color color) ### Description Construct a Rgb48Color using Rgbw64Color, copying the R,G,B values and ignoring the W value. Due to the loss of information of the W value, this constructor is marked explicit so it will not automatically be used for conversion. ### Parameters #### Path Parameters - **color** (Rgbw64Color) - Required - a Rgbw64Color object. ## Rgb48Color(RgbColor color) ### Description Construct a Rgb48Color using RgbColor, converting the R,G,B values. ### Parameters #### Path Parameters - **color** (RgbColor) - Required - a RgbColor object. ## Rgb48Color(HtmlColor color) ### Description Construct a Rgb48Color using HtmlColor, converting the Html single value to Rgb component values ### Parameters #### Path Parameters - **color** (HtmlColor) - Required - an HtmlColor object ## Rgb48Color(HslColor color) ### Description Construct a Rgb48Color using HslColor, converting the Hsl to Rgb ### Parameters #### Path Parameters - **color** (HslColor) - Required - an HslColor object ## Rgb48Color(HsbColor color) ### Description Construct a Rgb48Color using HsbColor, converting the Hsb to Rgb ### Parameters #### Path Parameters - **color** (HsbColor) - Required - an HsbColor object ## Rgb48Color() ### Description Construct a Rgb48Color that will have its values set in latter operations. CAUTION: The R,G,B members are not initialized and may not be consistent until set. ``` -------------------------------- ### Find Next Available Animation Channel Source: https://github.com/makuna/neopixelbus/wiki/NeoPixelAnimator-object-API Searches for an available animation channel starting from a specified index. If found, it sets the provided pointer to the index of the available channel. ```c++ bool NextAvailableAnimation(uint16_t* indexAvailable, uint16_t indexStart = 0) ``` -------------------------------- ### HsbColor Linear Blend Example Source: https://github.com/makuna/neopixelbus/wiki/HsbColor-object-API Blends between two HsbColor objects based on a progress value using a specified NeoHueBlend type. Progress ranges from 0.0f to 1.0f. ```csharp HsbColor results = HsbColor::LinearBlend(HsbColor(0.88f,1.0f,1.0f), HsbColor(0.12f,1.0f,1.0f), 0.33f); ``` -------------------------------- ### RgbwColor CompareTo Method Source: https://github.com/makuna/neopixelbus/wiki/RgbwColor-object-API Compares this color to another with a given epsilon, returning the greatest difference. ```cpp int16_t CompareTo(const RgbwColor& other, uint8_t epsilon = 1); ``` -------------------------------- ### ColumnMajorAlternatingLayout Example Source: https://github.com/makuna/neopixelbus/wiki/NeoMosaic-object Illustrates the pixel indexing for a 4x4 panel matrix with 2x2 tiles using the ColumnMajorAlternatingLayout. This layout is useful for visualizing the mapping of 2D coordinates to 1D indices. ```text 0 1 2 3 4 5 6 7 ------------------------------------------------------------------- 0 | 0< 7 8 15> 16< 23 24 31> 1 | 1 6 9 14 17 22 25 30 2 | 2 5 10 13 18 21 26 29 3 | 3 4 11 12 19 20 27 28 4 | 60 59 52 51 44 43 36 35 5 | 61 58 53 50 45 42 37 34 6 | 62 57 54 49 46 41 38 33 7 | 63> 56 55 48< 47> 40 39 32< ``` -------------------------------- ### Adafruit NeoPixel Library StrandTest Output (Gemma, IDE 1.6.5) Source: https://github.com/makuna/neopixelbus/wiki/Smaller-Code Shows the program storage space and dynamic memory usage for the Adafruit NeoPixel Library on a Gemma with Arduino IDE 1.6.5. ```text Sketch uses 3,498 bytes (65%) of program storage space. Maximum is 5,310 bytes. Global variables use 39 bytes of dynamic memory. ``` -------------------------------- ### NeoGammaDynamicTableMethod for Runtime Gamma Table Generation Source: https://github.com/makuna/neopixelbus/wiki/T_GAMMA Use NeoGammaDynamicTableMethod to dynamically generate a gamma lookup table at runtime for performance. This requires a custom callback function for calculations and initialization in setup(). ```c++ NeoPixelBusLg strip(PixelCount, PixelPin); ``` ```c++ NeoGamma colorGamma; ``` ```c++ float GammaCalc(float unitValue) { // we will use CieLab gamma equation for our custom table return NeoEase::GammaCieLab(unitValue); } ``` ```c++ setup() { NeoGammaDynamicTableMethod::Initialize(GammaCalc); strip.Begin(); } ``` -------------------------------- ### Set TM1814 Pixel Power Settings Source: https://github.com/makuna/neopixelbus/wiki/Neo-Features Configure power usage for TM1814 LEDs after calling Begin(). Arguments are in 1/10th milliamps. ```cpp strip.SetPixelSettings(NeoTm1814Settings(165,165,165,165)); // 16.5mA ``` -------------------------------- ### Convert RgbwColor to RgbColor by Ignoring White Source: https://github.com/makuna/neopixelbus/wiki/FAQ- When converting RgbwColor to RgbColor, you can choose to ignore the white component. This example demonstrates creating an RgbColor using only the R, G, and B values from the RgbwColor. ```C++ RgbwColor myColor(124, 64, 124, 10); RgbColor myRgbColor(myColor.R, myColor.G, myColor.B); // converted ignore the white ``` -------------------------------- ### DotStarMethod Constructor (BitBang) Source: https://github.com/makuna/neopixelbus/wiki/DotStar-Methods Use the generic DotStarMethod for APA102 LEDs when a specific method is not listed. It's a compatible first selection for BitBang implementations. ```c++ NeoPixelBus(uint16_t countPixels, uint8_t pinClock, uint8_t pinData) ``` -------------------------------- ### Apply Exponential Curve to Animation Progress Source: https://github.com/makuna/neopixelbus/wiki/NeoPixelAnimator-object Demonstrates how to apply an exponential easing curve to the animation progress within an update function. This can simulate effects like 'mass' for smoother animation starts and ends. ```C++ void UpdateAnim(AnimationParam param) { // apply a exponential curve to both front and back float progress = NeoEase::ExponentialInOut(param.progress); ... ``` -------------------------------- ### Adafruit NeoPixel Library StrandTest Output (Gemma, IDE 1.6.7/1.6.8) Source: https://github.com/makuna/neopixelbus/wiki/Smaller-Code Shows the program storage space and dynamic memory usage for the Adafruit NeoPixel Library on a Gemma with Arduino IDE 1.6.7/1.6.8. Note the slight increase in size from IDE 1.6.5. ```text Sketch uses 3,534 bytes (66%) of program storage space. Maximum is 5,310 bytes. Global variables use 39 bytes of dynamic memory.. ``` -------------------------------- ### Rgbw64Color Brighten Method (8-bit ratio) Source: https://github.com/makuna/neopixelbus/wiki/Rgbw64Color-object-API Returns a new color blended towards white by a linear ratio (0-255). 255 returns the original color, 0 returns white. ```cpp Rgbw64Color Brighten(uint8_t ratio); ``` -------------------------------- ### Rgbw64Color CompareTo Method Source: https://github.com/makuna/neopixelbus/wiki/Rgbw64Color-object-API Compares this color to another with a given epsilon. Returns the greatest difference, where 0 means colors are equal within epsilon. ```cpp int32_t CompareTo(const Rgbw64Color& other, uint16_t epsilon = 1); ``` -------------------------------- ### CompareTo Method Source: https://github.com/makuna/neopixelbus/wiki/RgbwwColor-object-API Compares this color to another color, considering an epsilon for tolerance. Returns the greatest difference, or 0 if colors are equal within epsilon. ```cpp int16_t CompareTo(const RgbwwColor& other, uint8_t epsilon = 1); ``` -------------------------------- ### Dump NeoPixelBus Index Grid to Serial Source: https://github.com/makuna/neopixelbus/wiki/Examples This sample uses NeoTiles and Layout objects to dump a grid of index values to the serial output. It helps visualize the physical layout of LED panels by displaying the NeoPixelBus index for each pixel, along with indicators for panel input ('<') and output ('>'). ```csharp 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 0 | 0< 15 16 31 32 47 48 63> 128< 143 144 159 160 175 176 191> 256< 271 272 287 288 303 304 319> 384< 399 400 415 416 431 432 447> 1 | 1 14 17 30 33 46 49 62 129 142 145 158 161 174 177 190 257 270 273 286 289 302 305 318 385 398 401 414 417 430 433 446 2 | 2 13 18 29 34 45 50 61 130 141 146 157 162 173 178 189 258 269 274 285 290 301 306 317 386 397 402 413 418 429 434 445 3 | 3 12 19 28 35 44 51 60 131 140 147 156 163 172 179 188 259 268 275 284 291 300 307 316 387 396 403 412 419 428 435 444 4 | 4 11 20 27 36 43 52 59 132 139 148 155 164 171 180 187 260 267 276 283 292 299 308 315 388 395 404 411 420 427 436 443 5 | 5 10 21 26 37 42 53 58 133 138 149 154 165 170 181 186 261 266 277 282 293 298 309 314 389 394 405 410 421 426 437 442 6 | 6 9 22 25 38 41 54 57 134 137 150 153 166 169 182 185 262 265 278 281 294 297 310 313 390 393 406 409 422 425 438 441 7 | 7 8 23 24 39 40 55 56 135 136 151 152 167 168 183 184 263 264 279 280 295 296 311 312 391 392 407 408 423 424 439 440 8 | 64< 79 80 95 96 111 112 127> 192< 207 208 223 224 239 240 255> 320< 335 336 351 352 367 368 383> 448< 463 464 479 480 495 496 511> 9 | 65 78 81 94 97 110 113 126 193 206 209 222 225 238 241 254 321 334 337 350 353 366 369 382 449 462 465 478 481 494 497 510 10 | 66 77 82 93 98 109 114 125 194 205 210 221 226 237 242 253 322 333 338 349 354 365 370 381 450 461 466 477 482 493 498 509 11 | 67 76 83 92 99 108 115 124 195 204 211 220 227 236 243 252 323 332 339 348 355 364 371 380 451 460 467 476 483 492 499 508 12 | 68 75 84 91 100 107 116 123 196 203 212 219 228 235 244 251 324 331 340 347 356 363 372 379 452 459 468 475 484 491 500 507 13 | 69 74 85 90 101 106 117 122 197 202 213 218 229 234 245 250 325 330 341 346 357 362 373 378 453 458 469 474 485 490 501 506 14 | 70 73 86 89 102 105 118 121 198 201 214 217 230 233 246 249 326 329 342 345 358 361 374 377 454 457 470 473 486 489 502 505 15 | 71 72 87 88 103 104 119 120 199 200 215 216 231 232 247 248 327 328 343 344 359 360 375 376 455 456 471 472 487 488 503 504 ``` -------------------------------- ### NeoPixelBusLg Constructors Source: https://github.com/makuna/neopixelbus/wiki/NeoPixelBusLg-object-API Constructors for initializing the NeoPixelBusLg object with specific color features, methods, and optional gamma correction. Different constructors are available based on the platform and connection type (e.g., pin-based, hardware-defined pin, or dual-pin for DotStar). ```APIDOC ## NeoPixelBusLg(uint16_t countPixels, uint8_t pin) ### Description Initializes the object to handle a specified number of pixels on a given output pin, using the provided Feature, Method, and Gamma specialization classes. ### Parameters #### Path Parameters - **countPixels** (uint16_t) - The number of pixels on the physical bus. - **pin** (uint8_t) - The output pin to use. Note: Some platforms and Methods restrict the Pin; use the constructor that omits the pin on Esp8266. ### Parameters #### Path Parameters - **countPixels** (uint16_t) - The number of pixels on the physical bus. ### Parameters #### Path Parameters - **countPixels** (uint16_t) - The number of pixels on the physical bus. - **pinClock** (uint8_t) - The clock output pin to use (for DotStar). - **pinData** (uint8_t) - The data output pin to use (for DotStar). ``` -------------------------------- ### RgbwwColor Constructor with HslColor Source: https://github.com/makuna/neopixelbus/wiki/RgbwwColor-object-API Constructs an RgbwwColor from an HslColor, converting HSL to RGBW. ```cpp RgbwwColor(HslColor color); ``` -------------------------------- ### NeoPixelBus Library StrandTest Output (Gemma, IDE 1.6.7/1.6.8) Source: https://github.com/makuna/neopixelbus/wiki/Smaller-Code Shows the program storage space and dynamic memory usage for the NeoPixelBus library on a Gemma with Arduino IDE 1.6.7/1.6.8. Note the slight increase in size from IDE 1.6.5. ```text Sketch uses 3,002 bytes (56%) of program storage space. Maximum is 5,310 bytes. Global variables use 34 bytes of dynamic memory. ```