i have a pressure sensor which gives me an output of 0-5v. im using this voltage as an analog input on my arduino board. the output should drive a relay and it will drive a pump.
what i want to do is when the sensor will give an input of 1-4v, this should activate my pump. if input is higher than 4v, pump stop. then the pump start again when the input voltage decreases to 1v then increase again to 4v for it to stop.
my problem here is that i don't know what statement to write so that the pump starts at 1v as input and it continues till the input voltage reaches 4v then it stop. then it should wait for the voltage to decrease to 1v for it to start again.
someone can help me to write some statement for such operation??