I am using 3 potentiometer to control automatic sprinkler. The problem is that the 2 of this pot's aren't working properly. When I change their value in isn't going beetwen setted, but it is about max value. I checked with multimeter that the voltage on the input pins changes from 0-5V, so I guess that is correct. I changed pots beetween pins and exactly the same pots aren't working on diffrent pins, but the pot that was woking is still working on diffrent pin, so the adc is working probably. I run out of ideas what to do. Pls help. Using arduino pro mini 5V.
byte outputPin1 = 4;
byte outputPin2 = 5;
byte frequencyPin = A3;
byte durationTimePin = A2;
byte offsetTimePin = A4;
unsigned long time = 0;
unsigned long lastTime = 180;
int dayCount = 0;
int minCount = 0;
byte waitTime = 3; //minut
byte frequency = 1; //dni
byte durationTime = 2; //minut*5
int offsetTime = 0; //minuty
void setup() {
pinMode(frequencyPin, INPUT);
pinMode(durationTimePin, INPUT);
pinMode(offsetTimePin, INPUT);
pinMode(outputPin1, OUTPUT);
pinMode(outputPin2, OUTPUT);
Serial.begin(9600);
}
void loop() {
while (millis()<=waitTime*60000 && dayCount == 0){ //First 3min for settings change
frequency = analogRead(frequencyPin);
frequency = map(frequency, 0, 1023, 7, 1);
durationTime = analogRead(durationTimePin);
durationTime = map(durationTime, 0, 1023, 12, 2);
durationTime = durationTime*5;
offsetTime = analogRead(offsetTimePin);
offsetTime = map(offsetTime, 0, 1023, 16, 0);
offsetTime = offsetTime*60;
Serial.print(180 - millis()/1000);
Serial.print(" Podlewać co: ");
Serial.print(frequency);
Serial.print(" dni przez: ");
Serial.print(durationTime);
Serial.print(" min zaczynając za: ");
Serial.print(offsetTime);
Serial.println(" min.");
}