简体   繁体   中英

DMX Arduino - Turn OFF lamp on Martin Exterior 600 fixture

I have made a web based light controller, and everything is working perfectly. But i have a problem turning off one of the fixtures.

For turning OFF the lamp, a value of 250 has to be send on channel 17 for at least 5 sec. And this is where it gets tricky, how do I do that?

I am using the DMXSerial library from http://www.mathertel.de/Arduino/DMXSerial.aspx , but it lacks documentation.

Here is a small piece off the code.

if(finder.find("#dmx")) { // Find out if this is a dmx string.
  if(finder.findUntil("type", ",")) {   // Finds the type
     cmd = finder.getValue();       // Putting the value found in its variable.
        if(cmd == 4) {
          if(finder.findUntil("ch", ",")) {
          channel = finder.getValue();
          }
          if(finder.findUntil("va", ",\n\r")) {
          val = finder.getValue();
          }
          if(channel == 17 && val == 250) {

            // some code here

          } else {
            DMXSerial.write(channel, val);
          }
        }
      }

Any help will be welcome.

The DMXSerial library's initialization

DMXSerial.init(DMXController);

enables the transmitter to be sending in the background and repeat sending the default values for the 512 channels, stored. Where

DMXSerial.write(ch, value);

updates the specified buffer location, which in turn is being sent out in the background.

The DMX frame is simply being repeated in the background, by way of transmit complete interrupts. A whole frame of 512 channels approximately repeats at 44Hz rate.

Since it is interrupt driven there is nothing more you need to do. So in essence it should be simply:

...
DMXSerial.write(17, 250);
delay(5100); 
DMXSerial.write(17, 0); // or something else
...

I would think a web put of updating the appropriate channel with a value that was 250 would suffice. As long as it was not updated again with something other than 250. As the background will keep sending it, until updated with something different.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM