Go Down

Topic: Flame detection and ignition with 3 attempts  (Read 436 times) previous topic - next topic

salmanikram

I am trying to build a safety project for my burner. I somehow managed to shut down all system with no flame but I want my ignitor to try 3 time before it close down all system can some body direct me here is my code.


#define FLMD 2  //FLAME DETECTION
#define MSOL 7  //MAIN SOLINOID VALVE
#define PSOL 5 //POILET SOLINOID VALVE
#define IGNI 6 //IGNITOR UNIT

void setup() {
  pinMode(FLMD,INPUT);//FLAME DETECTION
  pinMode(MSOL,OUTPUT); //MAIN SOLINOID VALVE
  pinMode(PSOL,OUTPUT);//POILET SOLINOID VALVE
  pinMode(IGNI,OUTPUT); //IGNITOR UNIT
 
  digitalWrite(FLMD,HIGH);
  digitalWrite(MSOL,HIGH);
  digitalWrite(PSOL,HIGH);
  digitalWrite(IGNI,HIGH);
 
  delay (2000);
  digitalWrite(PSOL,LOW);
  delay (3000);
  digitalWrite(IGNI,LOW);
  delay(5000);
  digitalWrite(MSOL,LOW);
  delay(2000);
  }

void loop() {
   if (digitalRead(FLMD) !=HIGH) {
        digitalWrite(MSOL,HIGH);
        digitalWrite(PSOL,HIGH);
        digitalWrite(IGNI,HIGH);
       
         }  else {
        digitalWrite(MSOL,LOW);
        digitalWrite(PSOL,LOW);
        digitalWrite(IGNI,LOW);
      }

}

Peter-CAD-HST

Hello salmanikram
How are you?
You have to include a time-stage  to your sketch.
with best regard
Peter
and stay healthy
KISS Q&D - keep calm and carry on - mind the gap - beware of sharks! -

salmanikram

Thanks Peter for your response please let me know what is this time stage?

Peter-CAD-HST

Hello salmanikram
How are you?
Yes I can do as follows:
You have to add a time function to your sketch by using the milli() function to avoid blocking the  execution.
With best regards
Peter
and stay healthy

KISS Q&D - keep calm and carry on - mind the gap - beware of sharks! -

salmanikram

Peter I am not familiar with function. Can you explain a bit more. Thanks

revolt_randy

Hello,
The method Peter-CAD-HST mentions can be found here:
https://learn.adafruit.com/multi-tasking-the-arduino-part-1

I have not looked at your code, but I understand what Peter-CAD-HST posted, and I think that link will help you.

Randy

Go Up