Code is meant to turn on an led (will be a liquid pump for soda when built IRL) for
a certain period of time depending on where the potentiometer
is set. led2 always turns on after either led1 or led3 are activated
even if the value from the potentiometer doesn't fall into led2's
range. I've tried multiple fixes, nothing has worked. The code is pasted below.
int sensorValue = 0;
int pot = A0;
int led1 = 13;
int led2 = 8;
int led3 = 3;
int buttonState = 0;
int button = 6;
Well, I expected it to make it so the if statement only happens if the sensor value falls between 800 and 900. I'm guessing that's wrong? Do you have a fix for that?
Edit: I was able to fix the problem by using an && statement, I should have thought of that sooner.