Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Artnet.h>
- #include <Ethernet.h>
- #include <EthernetUdp.h>
- #include <SPI.h>
- #include <FastLED.h>
- #define NUM_LEDS 170
- #define DATA_PIN 3
- CRGB leds[NUM_LEDS];
- // Configurações
- byte ip[] = {192, 168, 0, 30};
- byte mac[] = {0x04, 0xE9, 0xE5, 0x00, 0x69, 0xEC};
- const int universo = 0;
- Artnet artnet;
- void setup(){
- FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
- artnet.begin(mac, ip);
- artnet.setArtDmxCallback(onDmxFrame);
- }
- void loop()
- {
- artnet.read();
- }
- void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data)
- {
- if (universe == universo){
- for (int i = 0; i < length; i+3)
- {
- leds[i].setRGB( data[i],data[i+1], data[i+2]);
- }
- }
- FastLED.show();
- }
Add Comment
Please, Sign In to add comment