I am VERY new to the world of ARDUINO and I have to do a final class project. I wrote my code and realized I needed a way to check my sensor to meet a certain output before moving on to the next IF statement.
If you can't tell what my project is, I am using 2 flow-meters and 2 solenoid valves, 1 of each in series that is parallel to the other set. I put water flow through both meters. If I lose flow on one meter, I want the arduino to close the solenoid valve on the other flow-meter side.
I was thinking a DO statement, but I don't want the program to move on until there is HIGH's on both sensors on the first IF statement.
no, like I said before, I am VERY new to Arduino.
I need the code to, I guess, check the "state" of the meter. If it is HIGH, then go to next IF statement. If it is LOW, don't move on until it is HIGH.
I get what your saying with the 4 IF statements. But I dont think it will work like that. If i lose flow on one meter, I want the solenoid on the other meter to shut off until there is flow on the first meter. Then open back up and check the second meter. If I write it with 4 IF statements, wont it just recognize it as having no flow on both meters and shut both solenoids off?
I can draw a simple picture of my project if it will help with what i am trying to do
BSUSS:
no, like I said before, I am VERY new to Arduino.
I need the code to, I guess, check the "state" of the meter. If it is HIGH, then go to next IF statement. If it is LOW, don't move on until it is HIGH.
or something to that effect.
You actually have the "code" figured out, now just "read your statement in reverse" and arrange the code using "while" instead
while (read state == low ) {}; // stay in "while" when state is LOW
// continue process since state is now HIGH