Hi
i am working on a project
and im stopped a the last line of my code and canot find any solution
i want to control a relay board with 6 relay conected to digital 2 trough 7
and an analog pin A0 conected to a potentiometer 10k
everything is conected to an arduino promini 328
My problem is that every relay need to be cycled from one to the other each 24 hours
or in fact each 86400000 milisecond
if i set the delay directly at 86400000 millisecond everything work as wanted
but i need the delay to be adjustable with the potentiometer and now its my problem
i have try to map my delay directly into the delay(xxx); fuction
but everytime i am trying to do this the delay is gettin set to negative 30000millis through +30000
is there a limit of delay applied with a (map) function??
int chrg1 = 2;
int chrg2 = 3;
int chrg3 = 4;
int chrg4 = 5;
int chrg5 = 6;
int chrg6 = 7;
int led = 13;
int sensorPin = A3;
int sensorValue = 0;
int outputValue = 0;
int Map = 86400000;
void setup() {
Serial.begin(9600);
pinMode(chrg1, OUTPUT);
pinMode(chrg2, OUTPUT);
pinMode(chrg3, OUTPUT);
pinMode(chrg4, OUTPUT);
pinMode(chrg5, OUTPUT);
pinMode(chrg6, OUTPUT);
pinMode(led, OUTPUT);
}
void loop() {{
sensorValue = analogRead(sensorPin);
outputValue = map(sensorValue, 0, 1024, 0, 255);
Map = map(outputValue, 0,1024, 0, 255);
Serial.print("sensor = " );
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(Map);
}
digitalWrite(led, HIGH);
delay(100);
digitalWrite(led, LOW);
delay(100);
digitalWrite(led, HIGH);
delay(100);
digitalWrite(led, LOW);
delay(100);
digitalWrite(chrg1, HIGH);
delay(Map);
digitalWrite(chrg1, LOW);
delay(50);
digitalWrite(chrg2, HIGH);
delay(Map);
digitalWrite(chrg2, LOW);
delay(50);
digitalWrite(chrg3, HIGH);
delay(Map);
digitalWrite(chrg3, LOW);
delay(50);
digitalWrite(chrg4, HIGH);
delay(Map);
digitalWrite(chrg4, LOW);
delay(50);
digitalWrite(chrg5, HIGH);
delay(Map);
digitalWrite(chrg5, LOW);
delay(50);
digitalWrite(chrg6, HIGH);
delay(Map);
digitalWrite(chrg6, LOW);
delay(50);
}
thank you for your help
and sorry for my very bad english....
i am french canadian..