Activating LED on signal input=null

hello everyone ! I would like to ask you guys if someone could help me compiling this code to be able to use a LED when the flow meter's signal is null .. in other words, when there is no water passing through .
Also What boot should i use? I have arduino one r3 and i need to make it run without PC .
More detailed explanation:
A led should turn ON when the signal is null or 0
THe same led should turn OFF when the signal is >0
Should it be a signal dipendency or calculation based result - no importance here . But I think it would be more realible using the final result ( ex 0lt/h or 5lt/h)
So guys, could you please modify this code for me ?
If it was possible creating a blinking stage between 0 and >0 it would be even better !Like two blinks on LOW and three blinks before going HIGH

byte statusLed    = 13;
byte sensorInterrupt = 0;  // 0 = digital pin 2
byte sensorPin       = 2;
float calibrationFactor = 4.5;
volatile byte pulseCount;  
float flowRate;
unsigned int flowMilliLitres;
unsigned long totalMilliLitres;
unsigned long oldTime;
void setup()
{
  Serial.begin(9600);
  pinMode(statusLed, OUTPUT);
  digitalWrite(statusLed, HIGH); 
  
  pinMode(sensorPin, INPUT);
  digitalWrite(sensorPin, HIGH);

  pulseCount        = 0;
  flowRate          = 0.0;
  flowMilliLitres   = 0;
  totalMilliLitres  = 0;
  oldTime           = 0;
  attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
}
void loop()
{
   if((millis() - oldTime) > 1000)   
  { 
    detachInterrupt(sensorInterrupt);
    flowRate = ((1000.0 / (millis() - oldTime)) 
    oldTime = millis();
    flowMilliLitres = (flowRate / 60) * 1000;
    totalMilliLitres += flowMilliLitres;
    unsigned int frac;
    Serial.print("Flow rate: ");
    Serial.print(int(flowRate));  
    Serial.print("L/min");
    Serial.print("\t");     
    Serial.print("Output Liquid Quantity: ");        
    Serial.print(totalMilliLitres);
    Serial.println("mL"); 
    Serial.print("\t");       
  Serial.print(totalMilliLitres/1000);
  Serial.print("L");
    pulseCount = 0;
 attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
  }
}
void pulseCounter()
{
 pulseCount++;
}

That code does not work, does it? Don't you think you should fix it before you add another function?

Also What boot should i use? I have arduino one r3 and i need to make it run without PC .

No need to do anything that is the way Arduinos work.

Sighline:
If it was possible creating a blinking stage between 0 and >0 it would be even better !Like two blinks on LOW and three blinks before going HIGH

There isn't anything between 0 and >0. Any positive number is >0. And no program can see into the future to know that it is going to be greater than 0 in a while, just long enough to do a few blinks.

Steve

Thank you all guys, now it's just working fine .
How am I supposed to make it blink under this condition ?

void loop()
{
   
   if((millis() - oldTime) > 1000)
  { 
     detachInterrupt(sensorInterrupt);
        
    flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / calibrationFactor;
    oldTime = millis();
    flowMilliLitres = (flowRate / 60) * 1000;
    totalMilliLitres += flowMilliLitres;
    if (flowRate < 0.01) digitalWrite(GREEN,HIGH);   //main condition 
    else digitalWrite (GREEN,LOW);

Please post the complete code.

I can see at least 3 conditions even in that unhelpful fragment. Which one is "this condition"?

Steve

slipstick:
Please post the complete code.

I can see at least 3 conditions even in that unhelpful fragment. Which one is "this condition"?

Steve

here is the full code

#define GREEN 3
#define BLUE 6
#define WHITE 10 
#define RED 9 
#define YELLOW 11 
#define RED 5

const int ledPin = 3;
int ledState = LOW;
unsigned long previousMillis = 0;
const long interval = 1000;

byte statusLed    = 13;
byte sensorInterrupt = 0;
byte sensorPin       = 2;
float calibrationFactor = 4.5;
volatile byte pulseCount;  
float flowRate;
unsigned int flowMilliLitres;
unsigned long totalMilliLitres;
unsigned long oldTime;

void setup()
{
  
  Serial.begin(9600);
  pinMode(statusLed, OUTPUT);
  digitalWrite(statusLed, HIGH);
  pinMode(sensorPin, INPUT);
  digitalWrite(sensorPin, HIGH);
  pinMode(GREEN,OUTPUT);
  digitalWrite(GREEN,HIGH);
  digitalWrite(GREEN,LOW);
  pinMode(ledPin, OUTPUT);

  pinMode(BLUE,OUTPUT);
  digitalWrite(BLUE,HIGH);
  digitalWrite(BLUE,LOW);

  pinMode(WHITE,OUTPUT);
  digitalWrite(WHITE,HIGH);
  digitalWrite(WHITE,LOW);

  pinMode(RED,OUTPUT);
  digitalWrite(RED,HIGH);
  digitalWrite(RED,LOW);

  pinMode(YELLOW,OUTPUT);
  digitalWrite(YELLOW,HIGH);
  digitalWrite(YELLOW,LOW);

  pulseCount        = 0;
  flowRate          = 0.0;
  flowMilliLitres   = 0;
  totalMilliLitres  = 0;
  oldTime           = 0;

  
  attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
}


void loop()
{
  
   if((millis() - oldTime) > 1000)
  { 
     detachInterrupt(sensorInterrupt);
        
    flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / calibrationFactor;
    oldTime = millis();
    flowMilliLitres = (flowRate / 60) * 1000;
    totalMilliLitres += flowMilliLitres;
    if (ledState == LOW &&((flowRate < 0.01)) (digitalWrite(GREEN,HIGH));
    {
    ledState = HIGH;
    }
    
    else digitalWrite (GREEN,LOW);
    

     if (flowRate >= 4.00) digitalWrite(BLUE,HIGH);
    else digitalWrite (BLUE,LOW);

     if (flowRate >= 12.01) digitalWrite(WHITE,HIGH);
    else digitalWrite (WHITE,LOW);

     if (flowRate >= 22.1) digitalWrite(RED,HIGH);
    else digitalWrite (RED,LOW);

     if (flowRate >= 34.1) digitalWrite(YELLOW,HIGH);
    else digitalWrite (YELLOW,LOW);
      
    unsigned int frac;
    
    
    Serial.print("Flussometro: ");
    Serial.print(int(flowRate)); 
    Serial.print("L/min");
    Serial.print("\t");       

    Serial.print("Quantita': ");        
    Serial.print(totalMilliLitres);
    Serial.println("mL"); 
    Serial.print("\t");
    
    

    
    pulseCount = 0;
    
   
    attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
  }
}

void pulseCounter()
{
  pulseCount++;
}

the condition you can see in the void loop .
I just need to insert a double condition with double 'then' or 'do' to make a led blink when the flow is <0.01 (which will be a very good sign instead of just being lighted up ) , blinking is more notable
so my attempt was :

if (ledState == LOW &&((flowRate < 0.01)) (digitalWrite(GREEN,HIGH));
    {
    ledState = HIGH;
    }
    
    else digitalWrite (GREEN,LOW);

which did not work .. error in compiling /making order
Error message : expression cannot be used as a function, lighting up in red the '...If ..' string

if (flowRate < 0.01)
  if (ledState == LOW)
    ledState = HIGH;
  else
    ledState = LOW;
else
  ledState = LOW;

digitalWrite (GREEN, ledState);

you are simply the best out there I suppose.. I have recieved many suggestions in italian forum which was VERY difficult and barely functional . and your code just worked GREAT ! awesome PaulRB , nice work , Thank you very bery much . Nice one.

PaulRB:

if (flowRate < 0.01)

if (ledState == LOW)
    ledState = HIGH;
  else
    ledState = LOW;
else
  ledState = LOW;

digitalWrite (GREEN, ledState);

you are simply the best out there I suppose.. I have recieved many suggestions in italian forum which was VERY difficult and barely functional . and your code just worked GREAT ! awesome PaulRB , nice work , Thank you very bery much . Nice one.