Updated Add own functionality (markdown)

This commit is contained in:
Aircoookie 2019-11-13 11:47:08 +01:00
parent 620c69b2af
commit 6ec856cb2f
1 changed files with 17 additions and 1 deletions

View File

@ -43,7 +43,23 @@ void userLoop()
### Internal Segments API
TBD
You can use Segments from your code to set different parts of the strip to different colors or effects.
This can be very useful for highly customized installations, clocks, ...
To set a segment, use `strip.setSegment(id, start, stop);`, where _id_ is the segment ID, _start_ is the first LED of the segment and _stop_ is the LED after the last one in the segment.
To edit the configuration of a segment, use:
```cpp
WS2812FX::Segment& seg = strip.getSegment(id);
//set color (i=0 is primary, i=1 secondary i=2 tertiary)
seg.colors[i] = ((myWhite << 24) | ((myRed&0xFF) << 16) | ((myGreen&0xFF) << 8) | ((myBlue&0xFF)));
//set effect config
seg.mode = myFxI;
seg.speed = mySpeed;
seg.intensity = myIntensity;
seg.palette = myPaletteId;
```
Keep in mind that this will not cause interface updates as of 0.8.6. For that, you still need to use 'colorUpdated(1)'
### Create custom effects