void setup()
{
pinMode(flowmeter, INPUT);
Serial.begin(9600);
attachInterrupt(0, flow, RISING);
currentTime = millis();
cloopTime = currentTime;
}
void loop ()
{
currentTime = millis();
(currentTime = (cloopTime + 1000));
{
cloopTime = currentTime;
water_flow = (flow_frequency * 60 / 7.5); // (Pulse frequency x 60 min) / 7.5Q = flow rate in L/hour
flow_frequency = 0;
if (water_flow <50);
{Serial.print(water_flow,DEC); // Print litres/hour
Serial.println(" ML/min medium flow");
}
( water_flow>50);
{ Serial.print(water_flow,DEC);
Serial.println(" ML/min low flow");
}}}
this condition correct but i wanna exact output,how to use if else statement in this condition?
system
#2
void loop ()
{
currentTime = millis();
(currentTime = (cloopTime + 1000));
{
cloopTime = currentTime;
water_flow = (flow_frequency * 60 / 7.5); // (Pulse frequency x 60 min) / 7.5Q = flow rate in L/hour
flow_frequency = 0;
if (water_flow <50);
{Serial.print(water_flow,DEC); // Print litres/hour
Serial.println(" ML/min medium flow");
}
( water_flow>50);
{ Serial.print(water_flow,DEC);
Serial.println(" ML/min low flow");
}}}
That code (looks) like crap, with {useless} (curly) {braces} splattered all over that
piss-poorly indented
code.
Get rid of the useless parentheses.
Get rid of the useless code. Comparing water_flow to 50, and then doing nothing if it is, and nothing if it isn’t, is pointless.
Use Tools + Auto Format to properly indent the code.
this condition correct
What condition is correct?
but i wanna exact output
What?
how to use if else statement in this condition?
if(programmerIsClueless)
{
// Put the Arduino away and learn to program
}