DMX and Arduino

It’s got to be fast, that’s all that matters really.

#include <DmxSimple.h>

int incomingByte = 0; 
int ch = 0;
int alt = 0;

void setup() {

  Serial.begin(115200);
  DmxSimple.usePin(5);

}


void loop() {

        if (Serial.available() > 0) {
                incomingByte = Serial.read();
                
                if (alt > 0) {
                  DmxSimple.write(ch, incomingByte);
                  alt = 0;

                } else {
                  ch = incomingByte;
                  alt = 1;
                }
        }
}
Bookmark the permalink.

Comments are closed.