This commit is contained in:
Paul Zinselmeyer 2024-08-28 16:49:32 +02:00
commit 1e1637faad
Signed by: pfzetto
GPG key ID: B471A1AF06C895FD

38
thekenlicht.ino Normal file
View file

@ -0,0 +1,38 @@
#include "DMXUSB.h"
#define UNIVERSE 0
#define ADDRESS 1
#define RED_PIN 6
#define GREEN_PIN 9
#define BLUE_PIN 5
#define DMXUSB_BAUDRATE 115200
void dmxCallback(int universe, char buffer[512]) {
if (universe == UNIVERSE) {
// DMX-Address starts at one, buffer at zero
analogWrite(RED_PIN, buffer[ADDRESS-1]);
analogWrite(GREEN_PIN, buffer[ADDRESS]);
analogWrite(BLUE_PIN, buffer[ADDRESS+1]);
}
}
DMXUSB myDMXUsb(
Serial,
DMXUSB_BAUDRATE,
0,
dmxCallback
);
void setup() {
// setup pins
pinMode(RED_PIN, OUTPUT);
pinMode(GREEN_PIN, OUTPUT);
pinMode(BLUE_PIN, OUTPUT);
Serial.begin(DMXUSB_BAUDRATE);
}
void loop() {
myDMXUsb.listen();
}