This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
en:iot-open:practical:hardware:sut:stm32:emb8_1 [2024/04/20 09:45] – [Steps] ktokarz | en:iot-open:practical:hardware:sut:stm32:emb8_1 [2024/04/20 09:46] (current) – [Steps] ktokarz | ||
---|---|---|---|
Line 52: | Line 52: | ||
The strip class definition contains the number of pixels, the pin for transmission, | The strip class definition contains the number of pixels, the pin for transmission, | ||
=== Step 3 === | === Step 3 === | ||
- | To switch a particular LED, use the function '' | + | To switch a particular LED, use the function '' |
<code c> | <code c> | ||
void setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b); | void setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b); | ||
Line 60: | Line 60: | ||
If you use the second version you give the LED number as the first parameter and a 32-bit version of the colour information. To convert three RGB bytes to 32-bit value you can use the function '' | If you use the second version you give the LED number as the first parameter and a 32-bit version of the colour information. To convert three RGB bytes to 32-bit value you can use the function '' | ||
<code c> | <code c> | ||
- | static uint32_t Color(uint8_t r, uint8_t g, uint8_t b) | + | static uint32_t Color(uint8_t r, uint8_t g, uint8_t b); |
</ | </ | ||
<note tip>Note that the LED number is 0-based, so in the case of our laboratory equipment, valid indexes are 0...7.</ | <note tip>Note that the LED number is 0-based, so in the case of our laboratory equipment, valid indexes are 0...7.</ | ||
- | The setPixelColor() sets the appropriate data in the internal buffer of the class object. Sending it to the LED stripe requires the usage of the '' | + | The '' |
- | The different versions of the '' | + | The different versions of the '' |
<code c> | <code c> | ||
strip.setPixelColor(0, | strip.setPixelColor(0, |