add how to use ArtNet with FastLED
This commit is contained in:
parent
4c008d46a6
commit
54bc46b7fc
46
README.md
46
README.md
@ -119,6 +119,52 @@ void loop()
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Artnet Receiver + FastLED
|
||||||
|
|
||||||
|
|
||||||
|
``` C++
|
||||||
|
#include <Artnet.h>
|
||||||
|
|
||||||
|
// declarations for Ethernet/WiFi
|
||||||
|
|
||||||
|
ArtnetReceiver artnet;
|
||||||
|
|
||||||
|
// FastLED
|
||||||
|
#define NUM_LEDS 1
|
||||||
|
CRGB leds[NUM_LEDS];
|
||||||
|
const uint8_t PIN_LED_DATA = 3;
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
// setup Ethernet/WiFi...
|
||||||
|
|
||||||
|
// setup FastLED
|
||||||
|
FastLED.addLeds<NEOPIXEL, PIN_LED>(&leds, NUM_LEDS);
|
||||||
|
|
||||||
|
artnet.begin();
|
||||||
|
artnet.subscribe(universe, [](uint8_t* data, uint16_t size)
|
||||||
|
{
|
||||||
|
// artnet data size per packet is 512 max
|
||||||
|
// so there is max 170 pixel per packet (per universe)
|
||||||
|
for (size_t pixel = 0; pixel < NUM_LEDS; ++pixel)
|
||||||
|
{
|
||||||
|
size_t idx = pixel * 3;
|
||||||
|
leds[pixel].r = data[idx + 0];
|
||||||
|
leds[pixel].g = data[idx + 1];
|
||||||
|
leds[pixel].b = data[idx + 2];
|
||||||
|
}
|
||||||
|
FastLED.show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
artnet.parse(); // check if artnet packet has come and execute callback
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Other Settings
|
## Other Settings
|
||||||
|
|
||||||
### Net, Sub-Net, Universe, and Universe(15bit)
|
### Net, Sub-Net, Universe, and Universe(15bit)
|
||||||
|
Loading…
Reference in New Issue
Block a user