Creating a new DMX512 controlled device utilizing UNO

Firstly, I am aware Arduino makes a DMX shield. Great, I can use it to send the instructions via OSC. BUT, I've built a breadboard relay shield for controlling a simple stage device to use with these commands:

1) ON_fwd. //which is a simple momentary "On" triggering UNO to close a circuit until routine is interrupted. ( Line is logic level current/voltage ) Telemetry is simple 3 terminal fwd/off/rev described below connected to a motor speed control device (Like a PWM but w/MCU firmware pre-written & programmable features.) 2) ON_reverse // Which also same as above, different output pin UNO to speed control 3) count_rev and stop // "Here's tricky part....for me. Need to give a "Read digital count then stop" motor starts slow (2000ms to full speed. 1,600rpm but reading micro-switch off output shaft of 60:1 gearbox.), and a micro-switch gives on/off 176 times per complete 360 degree revolution which is the position I want to control.

DMX client apps control 'nodes' daisy chained like rs485 with a termination resistor. I want for now to use a "pre-existing" channel currently used like for a LED light. So the DMX controller would think it is a light, but operate it as commanded e.g. red light on = fwd spin; blue light on = reverse spin; grn light == stop (physically a 'N/O' [normally open switch] from the UNO output)... so on so forth.

Motor controller has these 3 input switch terminals: (logic level) Com (common or 0V (-) connection I'm using from the 10VDC powering arduino) FWD (forward.) REV (reverse.)

So, Com + FWD closed contact results in clockwise rotation until broken. Com + REV is same but counter rotation. Normal is open, and motor is off. NOTE: Motor controller is buffered so fast switching causes no harm or damage.

I imagine(d, past tense now) a simple code routine. Wanted to post thoughts before I got in and wasted anyone's time. Especially mine ;)

BTW, 1st POST "Hello World"

I cleaned up something I found below, and after many trials with other stuff - I am beginning here. This has a foundation to work into the DMX protocol. (0-255)

/*  Serial Port RGB led light controller
i.e. 255,0,255 = R,G,B WITH OFF,FULL BRIGHT,OFF

Main Code created 29 Nov 2010 by Tom Igoe,

Modifications for DMX512 by dzusfast 10-26-2015

// string to hold input
String inString = "";    
int currentColor = 0;
int red, green, blue = 0;

void setup() {
  // Open serial communications and wait for port to open:
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only

  // send an intro:
  Serial.println("\n\nEnter 0~255 RGB:");
  // set LED cathode pins as outputs:
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  // turn on pin 13 to power the LEDs:
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);

void loop() {
  int inChar;

  // Read serial input:
  if (Serial.available() > 0) {
    inChar =;

  if (isDigit(inChar)) {
    // convert the incoming byte to a char
    // and add it to the string:
    inString += (char)inChar;

  // if you get a comma, convert to a number,
  // set the appropriate color, and increment
  // the color counter:
  if (inChar == ',') {
    // do something different for each value of currentColor:
    switch (currentColor) {
      case 0:    // 0 = red
        red = inString.toInt();
        // clear the string for new input:
        inString = "";
      case 1:    // 1 = green:
        green = inString.toInt();
        // clear the string for new input:
        inString = "";
  // if you get a newline, you know you've got
  // the last color, i.e. blue:
  if (inChar == '\n') {
    blue = inString.toInt();

    // set the levels of the LED.
    // subtract value from 255 because a higher
    // analogWrite level means a dimmer LED, since
    // you're raising the level on the anode:
    analogWrite(9, 255 - red);
    analogWrite(10, 255 - green);
    analogWrite(11, 255 - blue);
    // print the colors:
    Serial.print("Red: ");
    Serial.print("Green: ");
    Serial.print("Blue: ");

    // clear the string for new input:
    inString = "";
    // reset the color counter:
    currentColor = 0;


So, starting with the above, 0-177 can be an "on", and 178-255 can equal "off" for what I need being that I don't need any variableoutput signal; my breadboard is >1.7vdc transistor turning on small 5v relays.

bumpity bump? …anyone, I respectfully hope in my ignorance someone can help me simplify the output values to if <127 “OFF” ; else =>127 “ON” for the above code.

no special .h file present. And bread boarded perfect operation but unless I add a conundrum of resstors and NPNs to a beautiful board, I need to re-vamp the code as described.