Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Simple Example

The following example illustrates the usage of the DMX shield:

Code Block
languagecpp
// DMX Writer

#include <DmxSimple.h>

void setup() {
  Serial.begin(115200);
  DmxSimple.usePin(11);
}

long long time = 0;

int step = 0;

void loop() {
  // wait 16ms (60/s) between animation steps
  if (time < millis() - 16) {
    // this is necessary to give the interrupt routine
    // enough time to write the dmx messages
    Serial.println("stepstepstepstep");
    
    // set time
    time = millis();

    // set rgb
    DmxSimple.write(1, step);
    DmxSimple.write(2, step);
    DmxSimple.write(3, step);

    // increment
    step += 1;

    // handle wrapping
    if (step > 255) {
      step = 0;
    }
  }
}

Arduino DMX Bridge

Um Daten von Processing an DMX zu übergeben nutzen wir ein Arduino als Brücke. Auf das Arduino setzen wir das DMX Shield und programmieren es mit dem folgenden Code:

...