xlights arduino dimmer

stockleys

New elf
Joined
Dec 27, 2020
Messages
1
hi all
newbie here.
i am wanting to built an arduino controller for dumb leds to work with xlights via e1.31.

i can do dmx led dimmers, but i am at a loss for e1.31 led dimmers.
i have found plenty of codes for e1.31 relays, but i want to be able to dim, not just switch on and off.

any help would be much appriciated.

many thanks
 

SmartAlecLights

Im a SmartAlec what can i say!
Community project designer
Joined
May 4, 2010
Messages
1,533
Location
Murray Bridge, S.A.
This is all i could find in my library,
it looks like its done on a esp8266 board
Hope this gives you something to start with

Code:
#include <ESP8266WiFi.h>
#include <E131.h>

const char ssid[] = "Your_Wifi_Name";         /* Replace with your SSID */
const char passphrase[] = "Your_Wifi_Password";   /* Replace with your WPA2 passphrase */
const int universe = 1;   /* Replace with your universe number */
const int channel = 1;   /* Replace with your first channel number */
    uint8_t     ip[] = "192.168.1.10";  /* Replace with your Static IP number */
    uint8_t     netmask[] = "255.255.255.0";
    uint8_t     gateway[] = "192.168.1.250";
    uint8_t     dns[] = "192.168.1.254";

E131 e131;

void setup() {
    // prepare GPIOs
    pinMode(14, OUTPUT); // set GPIO 0 as output
    pinMode(12, OUTPUT); // set GPIO 0 as output
    pinMode(13, OUTPUT); // set GPIO 0 as output
    pinMode(4, OUTPUT); // set GPIO 0 as output
    pinMode(5, OUTPUT); // set GPIO 0 as output
    pinMode(16, OUTPUT); // set GPIO 0 as output
 
    analogWrite(14, 0); // set GPIO 0 LOW = off
    analogWrite(12, 0); // set GPIO 0 LOW = off
    analogWrite(13, 0); // set GPIO 0 LOW = off
    analogWrite(4, 0); // set GPIO 0 LOW = off
    analogWrite(5, 0); // set GPIO 0 LOW = off
    analogWrite(16, 0); // set GPIO 0 LOW = off

    /* Choose one to begin listening for E1.31 data */
    e131.begin(ssid, passphrase);               /* via Unicast on the default port */
WiFi.config(ip, gateway, netmask, dns);
//        e131.config(IPAddress(ip, gateway, netmask );
//    e131.beginMulticast(ssid, passphrase, universe); /* via Multicast for Universe 1 */
}

void loop() {
    /* Parse a packet */
    uint16_t num_channels = e131.parsePacket();
 
    /* Process channel data if we have it */
    if (num_channels) {
    // OUTPUT
        analogWrite(14,(e131.data[channel -1]));
        analogWrite(12,(e131.data[channel +0]));
        analogWrite(13,(e131.data[channel +1]));
        analogWrite(4,(e131.data[channel +2]));
        analogWrite(5,(e131.data[channel +3]));
        analogWrite(16,(e131.data[channel +4]));
    }
}
 
Top