A sample Arudino DMX Slave with Conceptinetics Arduino Library

Overview

This is a demo setup for using a Arduino Nano with a MAX485 as a DMX Slave. If the dmx channel 1 is set above 127, the arduino led (13) will light up.

 

You need the copy the external library conceptinetics into the arduino library folder to get it working. The hardware serial will be used for communication, so you won't be able to print on the console with Serial.println.

Code

#include <Conceptinetics.h>

 

#define DMX_SLAVE_CHANNELS 1

#define RXEN_PIN 2

 

DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS );

const int ledPin = 13;

void setup() { 

// Enable DMX slave interface and start recording
// DMX data
dmx_slave.enable (); 

// Set start address to 1, this is also the default setting
// You can change this address at any time during the program
dmx_slave.setStartAddress (1);

// Set led pin as output pin
pinMode ( ledPin, OUTPUT );
}

// the loop routine runs over and over again forever:
void loop() 
{

// NOTE:
// getChannelValue is relative to the configured startaddress
if ( dmx_slave.getChannelValue (1) > 127 ) {
digitalWrite ( ledPin, HIGH );
} else {
digitalWrite ( ledPin, LOW );
}


}