### Show LED Updates Source: http://www.pjrc.com/teensy/td_libs_OctoWS2811.html Initiate an update to the LEDs with the currently set pixel data. This function returns quickly, but the display update continues in the background. If called during an active update, it waits for completion before starting a new one. ```cpp leds.show(); ``` -------------------------------- ### Get Pixel Color Source: http://www.pjrc.com/teensy/td_libs_OctoWS2811.html Retrieve the current color of a specific pixel. The function returns the color as a 24-bit number in RGB order. ```cpp leds.getPixel(num); ``` -------------------------------- ### leds.begin() Source: http://www.pjrc.com/teensy/td_libs_OctoWS2811.html Initializes the OctoWS2811 library. This function must be called before any other library functions like setPixel() or show(). ```APIDOC ## leds.begin() ### Description Initializes the library. Must be called before using setPixel or show. ### Method `void begin();` ``` -------------------------------- ### leds.show() Source: http://www.pjrc.com/teensy/td_libs_OctoWS2811.html Initiates an update of the LEDs with the currently set pixel data. This function returns quickly, allowing the display update to proceed in the background. ```APIDOC ## leds.show() ### Description Starts an update of the LEDs with the current pixel data. This function returns quickly, and the display update continues in the background. ### Method `void show();` ### Notes If called while a previous update is running, this function waits for the previous update to complete before starting a new one. ``` -------------------------------- ### Configure VideoDisplay Parameters Source: http://www.pjrc.com/teensy/td_libs_OctoWS2811.html These parameters define the physical LED arrangement and the portion of the video to be displayed on each Teensy board. Adjust LED_WIDTH, LED_HEIGHT, and LED_LAYOUT for your specific LED matrix. VIDEO_XOFFSET, VIDEO_YOFFSET, VIDEO_WIDTH, and VIDEO_HEIGHT determine which part of the video stream is shown. ```c++ #include // The actual arrangement of the LEDs connected to this Teensy 3.0 board. #define LED_WIDTH 60 // number of LEDs horizontally #define LED_HEIGHT 16 // number of LEDs vertically (must be multiple of 8) #define LED_LAYOUT 0 // 0 = even rows left->right, 1 = even rows right->left // The portion of the video image to show on this set of LEDs. All 4 numbers // are percentages, from 0 to 100. #define VIDEO_XOFFSET 0 #define VIDEO_YOFFSET 0 // display entire image (single Teensy) #define VIDEO_WIDTH 100 #define VIDEO_HEIGHT 100 ``` -------------------------------- ### Initialize OctoWS2811 Library Source: http://www.pjrc.com/teensy/td_libs_OctoWS2811.html Call this function after creating the OctoWS2811 object to initialize the library. It must be called before using functions like setPixel or show. ```cpp leds.begin(); ``` -------------------------------- ### OctoWS2811 Object Creation Source: http://www.pjrc.com/teensy/td_libs_OctoWS2811.html Instantiate the OctoWS2811 library. Only one object can be created. Parameters define the number of LEDs per strip, memory allocation for display and drawing, and configuration options for LED type and speed. ```APIDOC ## OctoWS2811 Object Creation ### Description Create an OctoWS2811 object with the following parameters: ### Parameters * **ledsPerStrip** (int) - The number of LEDs connected to each strip, or the maximum number if they vary. * **displayMemory** (int array) - Memory buffer for display data. Should be an array of 'int' 6 times ledsPerStrip. * **drawingMemory** (int array or NULL) - Memory buffer for drawing operations. Can be an array of 'int' 6 times ledsPerStrip, or NULL to draw directly to display memory. * **config** (enum) - Configuration options for WS2811 speed and color order. Options include WS2811_RGB, WS2811_RBG, WS2811_GRB, WS2811_GBR, WS2811_800kHz, WS2811_400kHz. ``` -------------------------------- ### OctoWS2811 Object Creation Source: http://www.pjrc.com/teensy/td_libs_OctoWS2811.html Instantiate the OctoWS2811 library object. Ensure you only create one object and provide the correct parameters for LEDs per strip, display memory, drawing memory, and configuration options for WS2811 speed and color order. ```cpp OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config); ``` -------------------------------- ### leds.busy() Source: http://www.pjrc.com/teensy/td_libs_OctoWS2811.html Checks if the library is currently updating the LEDs. Returns true if an update is in progress, and false otherwise. ```APIDOC ## leds.busy() ### Description Checks if a previous show() operation is still running. ### Returns * `true` if the WS2811 LEDs are busy being updated. * `false` if no update is in progress. ### Method `bool busy();` ``` -------------------------------- ### Check if LEDs are Busy Source: http://www.pjrc.com/teensy/td_libs_OctoWS2811.html Determine if the library is currently updating the WS2811 LEDs. Returns true if an update is in progress, and false otherwise. ```cpp leds.busy(); ``` -------------------------------- ### Set Pixel Color (24-bit) Source: http://www.pjrc.com/teensy/td_libs_OctoWS2811.html Set the color of a specific pixel using a single 24-bit color value. The color is expected in RGB order, similar to HTML color formats. ```cpp leds.setPixel(num, color); ``` -------------------------------- ### Set Pixel Color (RGB) Source: http://www.pjrc.com/teensy/td_libs_OctoWS2811.html Set the color of a specific pixel using individual Red, Green, and Blue values. Each color component should be between 0 and 255. ```cpp leds.setPixel(num, red, green, blue); ``` -------------------------------- ### leds.getPixel(num) Source: http://www.pjrc.com/teensy/td_libs_OctoWS2811.html Retrieves the current color of a specific pixel. Returns the color as a 24-bit RGB value. ```APIDOC ## leds.getPixel(num) ### Description Reads the color of a specific pixel. ### Parameters * **num** (int) - The index of the pixel to read. ### Returns A 24-bit color number representing the pixel's color. ### Method `int getPixel(int num);` ``` -------------------------------- ### leds.setPixel(num, color) Source: http://www.pjrc.com/teensy/td_libs_OctoWS2811.html Sets the color of a specific pixel using a 24-bit RGB color value. ```APIDOC ## leds.setPixel(num, color) ### Description Sets the color of a specific pixel using a 24-bit RGB color value. ### Parameters * **num** (int) - The index of the pixel to set. * **color** (int) - A 24-bit color value in RGB order (similar to HTML color format). ### Method `void setPixel(int num, int color);` ``` -------------------------------- ### leds.setPixel(num, red, green, blue) Source: http://www.pjrc.com/teensy/td_libs_OctoWS2811.html Sets the color of a specific pixel. Accepts individual red, green, and blue values ranging from 0 to 255. ```APIDOC ## leds.setPixel(num, red, green, blue) ### Description Sets the color of a specific pixel using individual RGB values. ### Parameters * **num** (int) - The index of the pixel to set. * **red** (int) - The red component (0-255). * **green** (int) - The green component (0-255). * **blue** (int) - The blue component (0-255). ### Method `void setPixel(int num, int red, int green, int blue);` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.