init
This commit is contained in:
commit
1e1637faad
1 changed files with 38 additions and 0 deletions
38
thekenlicht.ino
Normal file
38
thekenlicht.ino
Normal 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();
|
||||
}
|
Loading…
Reference in a new issue