Update Pixels.md

This commit is contained in:
HomeSpan 2022-02-19 12:26:43 -06:00 committed by GitHub
parent 72a042b7cc
commit c06daedfba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 3 deletions

View File

@ -25,15 +25,30 @@ Creating an instance of this **class** configures the specified *pin* to output
* `void set(Color *color, int nPixels)`
* individually sets the color of each pixel in a multi-pixel device to the color values specified in the **Color** array *\*color*, of *nPixels* size, where the first pixel of the device is set to the value in *color\[0\]*, the second pixel is set to the value in *color\[1\]* ... and the last pixel is set to the value in *color\[nPixels-1\]*. Similar to above, it is not a problem if the value specified for *nPixels* does not match the total number of actual RGB (or RGBW) pixels in your device; if *nPixels* is less than the total number of device pixels, only the first *nPixels* will be set to the values in the *\*color* array; if *nPixels* is greater than the total number of device pixels, the device will simply ignore the additional input
* individually sets the color of each pixel in a multi-pixel device to the color values specified in the **Color** array *\*color*, of *nPixels* size, where the first pixel of the device is set to the value in *color\[0\]*, the second pixel is set to the value in *color\[1\]* ... and the last pixel is set to the value in *color\[nPixels-1\]*. Similar to above, it is not a problem if the value specified for *nPixels* does not match the total number of actual RGB (or RGBW) pixels in your device
* `struct Color`
* instantiates a "blank" 32-bit Color object capable of holding four 8-bit RGBW values
* examples: `Pixel::Color myColor;` or `Pixel::Color myColors[8];`
* values for a Color object are set using the following methods:
* `Color RGB(uint8_t r, uint8_t g, uint8_t b, uint8_t w=0)`
* where *r*, *g*, and *b*, represent 8-bit red, green, and blue values over the range 0-255, and *w* represents an 8-bit value [0-255] for the white LED. The white value may be left unspecified, in which case it defaults to 0. Also, the white value will be ignored by *set()* unless the *isRGBW* flag was specified as *true* in the constructor; and
* `Color HSV(float h, float s, float v, double w=0)`
* where *h*=Hue, over the range 0-360; *s*=Saturation percentage from 0-100; and *v*=Brightness percentage from 0-100. These values are converted to equivalent 8-bit RGB values, each from 0-255 for storage in the Color object. Note the *w* value is treated separately and represents a percentage of brightness for the white LED (from 0-100) that is also converted into an 8-bit value from 0-255 for storage in the Color object. Similar to above, the white value may be left unspecified, in which case it defaults to 0
* both methods above return the completed Color object itself and can thus be used wherever a Color object is required
* `static Color RGB(uint8_t r, uint8_t g, uint8_t b, uint8_t w=0)`
* returns a **Color** object, where *r*, *g*, and *b*, represent 8-bit red, green, and blue values over the range 0-255, and *w* represents an 8-bit value [0-255] for the white LED. The white value may be left unspecified, in which case it defaults to 0. Also, the white value will be ignored by *set()* unless the *isRGBW* flag was specified as *true* in the constructor
* a convenience, class-level function that returns a **Color** object. Equivalent to `return(Color().RGB(r,g,b,w));`
* `static Color HSV(float h, float s, float v, double w=0)`
* returns a **Color** object after converting the values of *h*, *s*, and *v* (where *h*=Hue from 0-360; *s*=Saturation percentage from 0-100; *v*=Brightness percentage from 0-100) to equivalent 8-bit RGB values, each from 0-255. The *w* value is treated separately and represents a percentage of brightness for the white LED (from 0-100) that is subsequently converted into an 8-bit value from 0-255. The white value may be left unspecified, in which case it defaults to 0. Also, the white value will be ignored by *set()* unless the *isRGBW* flag was specified as *true* in the constructor
* a convenience, class-level function that returns a **Color** object. Equivalent to `return(Color().HSV(h,s,v,w));`
* returns a **Color** object after converting the values of *h*, *s*, and *v* (where *h*=Hue from 0-360; *s*=Saturation percentage from 0-100; *v*=Brightness percentage from 0-100) to equivalent 8-bit RGB values, each from 0-255. The *w* value is treated separately and represents a percentage of brightness for the white LED (from 0-100) that is subsequently converted into an 8-bit value from 0-255. The white value may be left unspecified, in which case it defaults to 0. Also, the white value will be ignored by *set()* unless the *isRGBW* flag was specified as *true* in the constructor