DMX script help

Hello everyone, im quite new to aurduino and trying to do a small DMX project that i need help with.

I have a small dc generator/motor that produce a small current when i turn it connected to a DMX shield (aurduino uno) to the GND and A0 and got for a DMX master script from github that allows me to use it as a master for my light dimmer.

I been tinkering for a few days now and im trying to redo the script so i allows me to use all A0-5 inputs as independent channels. Right now i only manage to have them turn on all the lights on the dimmer.

So basically, do you think i can make it work for one channel at the time?
a0 turn on dimmer channel 1
a1 turn on dimmer channel 2 etc...

Below is the code i been using!

all help greatly appreciated! :slight_smile:

#include <RunningAverage.h>

/*

#include <Conceptinetics.h>

#define DMX_MASTER_CHANNELS 100

#define RXEN_PIN 2

DMX_Master dmx_master ( DMX_MASTER_CHANNELS, RXEN_PIN );
RunningAverage DMX1(60);
static int dimmer_val;
void setup() {

dmx_master.enable ();

dmx_master.setChannelRange ( 1, 25, 127 );
}

void loop() {

int sensorValue1 = analogRead(A0);
int sensorValue2 = analogRead(A1);
int sensorValue3 = analogRead(A2);
int sensorValue4 = analogRead(A3);
int sensorValue5 = analogRead(A4);
int sensorValue6 = analogRead(A5);

 int voltage1 = sensorValue1 * (255.0 / 1023.0);
 int voltage2 = sensorValue2 * (255.0 / 1023.0); 
 int voltage3 = sensorValue3 * (255.0 / 1023.0);
 int voltage4 = sensorValue4 * (255.0 / 1023.0);
 int voltage5 = sensorValue5 * (255.0 / 1023.0); 
 int voltage6 = sensorValue6 * (255.0 / 1023.0);

delay(100);

DMX1.addValue(voltage1);

dmx_master.setChannelValue ( 1, voltage1 );

}

Please use </> code-tags to post your code.

int sensorValue1 = analogRead(A0);
int sensorValue2 = analogRead(A1);
int sensorValue3 = analogRead(A2);
int sensorValue4 = analogRead(A3);
int sensorValue5 = analogRead(A4);
int sensorValue6 = analogRead(A5);

normally one would use an array and a loop to read those values.

 int voltage1 = sensorValue1 * (255.0 / 1023.0);

a simpler way would be

 int voltage1 = sensorValue1 >> 2;

The 'runnig average' thing i am nor familiar with, but i would probably not even bother and rather just add an extra capacitor on the analog input.