Arduino Vixen Lights

Hi, I need your help. I want to use my Arduino with Vixen Lights and I´m using the Arduino Mega with a 8 Channel Relay Shield. The Programm sends 5V data, when you select the field in the programm. I need to change it in the Arduino Code. I need GND to be connected to the Pin, when a Signal is sended. So the opposide of the standard.
This is my Code. I hope you understood my problem and can help me.

int A = 22;
int B = 23;
int C = 24;
int D = 25;
int E = 26;
int F = 27;
int G = 28;
int H = 29;
int I = 30;
int J = 31;
int K = 32;
int L = 33;
int M = 34;
int N = 35;
int O = 36;
int P = 37;
int Q = 38;
int R = 39;
int S = 40;
int T = 41;

int i = 0;
int incomingByte[20];

void setup()

pinMode(A, OUTPUT);
pinMode(B, OUTPUT);
pinMode(C, OUTPUT);
pinMode(D, OUTPUT);
pinMode(E, OUTPUT);
pinMode(F, OUTPUT);
pinMode(G, OUTPUT);
pinMode(H, OUTPUT);
pinMode(I, OUTPUT);
pinMode(J, OUTPUT);
pinMode(K, OUTPUT);
pinMode(L, OUTPUT);
pinMode(M, OUTPUT);
pinMode(N, OUTPUT);
pinMode(O, OUTPUT);
pinMode(P, OUTPUT);
pinMode(Q, OUTPUT);
pinMode(R, OUTPUT);
pinMode(S, OUTPUT);
pinMode(T, OUTPUT);


void loop()
if (Serial.available() >= 20)
for (int i=0; i<20;i++)
incomingByte =;

  • }*

  • digitalWrite(A, incomingByte[0]);*

  • digitalWrite(B, incomingByte[1]);*

  • digitalWrite(C, incomingByte[2]);*

  • digitalWrite(D, incomingByte[3]);*

  • digitalWrite(E, incomingByte[4]);*

  • digitalWrite(F, incomingByte[5]);*

  • digitalWrite(G, incomingByte[6]);*

  • digitalWrite(H, incomingByte[7]);*

  • digitalWrite(I, incomingByte[8]);*

  • digitalWrite(J, incomingByte[9]);*

  • digitalWrite(K, incomingByte[10]);*

  • digitalWrite(L, incomingByte[11]);*

  • digitalWrite(M, incomingByte[12]);*

  • digitalWrite(N, incomingByte[13]);*

  • digitalWrite(O, incomingByte[14]);*

  • digitalWrite(P, incomingByte[15]);*

  • digitalWrite(Q, incomingByte[16]);*

  • digitalWrite(R, incomingByte[17]);*

  • digitalWrite(S, incomingByte[18]);*

  • digitalWrite(T, incomingByte[19]); *

  • }*

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup (the italics in the above code for example), leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn’t show the posting toolbar then you can just manually add the code tags:


[color=blue]// your code is here[/color]


Using code tags and other important information is explained in the How to use this forum post. Please read it.

I would do something like this:

const byte activeCommand = 1;
const byte inactiveCommand = 0;
const byte activeState = LOW;
const byte inactiveState = HIGH;

const byte LEDpin[]={22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41};

for (int i=0; i<20;i++)
  if( == activeCommand)
    digitalWrite(LEDpin[i], activeState);
    digitalWrite(LEDpin[i], inactiveState);

You’ll note I put the pins in an array, which allows you to change things without editing 20 lines of code every time. I’ll let you figure out how to handle the pinMode update.

I hope you understood my problem

No. I haven’t a clue what your problem is.

I DO know that that code hasn’t a hope in hell of compiling.

One letter global variable names are a really bad idea. STOP doing that.