Skip to content

Commit

Permalink
update input example
Browse files Browse the repository at this point in the history
  • Loading branch information
claudeheintz committed Jul 25, 2018
1 parent d447651 commit 6cf34c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions examples/DMXInputTest/DMXInputTest.ino
Expand Up @@ -17,6 +17,7 @@
int got_dmx = 0;

void setup() {
WiFi.forceSleepBegin(); //not using WiFi, sleep to prevent background activity
pinMode(BUILTIN_LED, OUTPUT);
pinMode(14, OUTPUT);
ESP8266DMX.setDataReceivedCallback(&gotDMXCallback);
Expand Down
9 changes: 6 additions & 3 deletions examples/RDMDeviceTest/RDMDeviceTest.ino
Expand Up @@ -20,6 +20,7 @@ int got_dmx = 0;
int got_rdm = 0;
uint8_t discovery_enabled = 1;
uint16_t start_address = 1;
uint16_t input_value = 0;

uint8_t device_label[33];

Expand All @@ -32,7 +33,7 @@ uint8_t device_label[33];

void setup() {
WiFi.forceSleepBegin();
delay(1);
delay(5000);
Serial.setDebugOutput(1); //use uart0 for debugging

pinMode(BUILTIN_LED, OUTPUT);
Expand Down Expand Up @@ -72,9 +73,11 @@ ICACHE_RAM_ATTR void gotRDMCallback(int len) {

void loop() {
if ( got_dmx ) {

input_value = ESP8266DMX.getSlot(start_address);
//gamma correct
input_value = (input_value * input_value ) / 255;
//ESP8266 PWM is 10bit 0-1024
analogWrite(LED_PIN,2*ESP8266DMX.getSlot(start_address));
analogWrite(LED_PIN,2*input_value);
got_dmx = 0; //reset

} else if ( got_rdm ) {
Expand Down

0 comments on commit 6cf34c9

Please sign in to comment.