I have a project that I have completed what I originally wanted but now want to add to it.
It is running on a Arduino mini.
I have a Reef lighting controller (DIM4) that outputs a 0-10v analog dimming but my Led drivers are PWM.
I have the mini converting it for me and it works well.
so here is what I would like to add to it. I want a override button to toggle all lights on or all off for a fixed period of time.
here is the sketch for the conversion I am running but I need a nudge in the right direction for the override
// These constants won't change. They're used to give names
// to the pins used:
const int analogInPin1 = A0; // Analog input pin Ch.1
const int analogInPin2 = A1; // Analog input pin Ch.2
const int analogInPin3 = A2; // Analog input pin Ch.3
const int analogOutPin1 = 6; // Analog output pin that the Ch.1 is attached to
const int analogOutPin2 = 10; // Analog output pin that the Ch.2 is attached to
const int analogOutPin3 = 11; // Analog output pin that the Ch.3 is attached to
const int lowerlimit = 90; // Any input below this value on inputs = 0 on outputs
const int upperlimit1 = 850; //Highest input value.. use to limit Max on Ch.1
const int upperlimit2 = 900; //Highest input value.. use to limit Max on Ch.2
const int upperlimit3 = 900; //Highest input value.. use to limit Max on Ch.3
int sensorValue1 = 0; // value read from input1 A0
int sensorValue2 = 0; // value read from input2 A1
int sensorValue3 = 0; // value read from input3 A2
int outputValue1 = 0; // value output to the PWM ch.1
int outputValue2 = 0; // value output to the PWM ch.2
int outputValue3 = 0; // value output to the PWM ch.3
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog in value:
sensorValue1 = analogRead(analogInPin1);
// map it to the range of the analog out:
sensorValue1 = constrain(sensorValue1, lowerlimit, upperlimit1) ; //constrain the input to these values ch.1
outputValue1 = map(sensorValue1, lowerlimit, 1023, 0, 255); // change the analog out value1:
analogWrite(analogOutPin1, outputValue1); // read the analog in value2:
sensorValue2 = analogRead(analogInPin2); // map it to the range of the analog out:
sensorValue2 = constrain(sensorValue2, lowerlimit, upperlimit2) ; //constrain the input to these values ch.2
outputValue2 = map(sensorValue2, lowerlimit, 1023, 0, 255); // change the analog out value:
analogWrite(analogOutPin2, outputValue2); // read the analog in value2:
sensorValue3 = analogRead(analogInPin3); // map it to the range of the analog out:
sensorValue3 = constrain(sensorValue3, lowerlimit, upperlimit3) ; //constrain the input to these values ch.3
outputValue3 = map(sensorValue3, lowerlimit , 1023, 0, 255); // change the analog out value:
analogWrite(analogOutPin3, outputValue3); // read the analog in value3:
delay(500);
}