Hi,
Is there anything to stop a void loop?
Why! My program runs a system ignitor which if after 3 attemps a flame is not detected (via thermocouple+co amp) switches on a warning lamp while shut down a gas solenoid and the system.
Help please...
Thanks
Kenneth
code below
//----Igniton Module v3.0
//----by Kenneth Agius
#define Ignitor 13
#define Solenoid 12
int x;
int IgnitionStarts = 1;
int BeforeFlameOn;
int AfterFlameOn;
//-------------------------------------------------------------------------------\
void setup() // run once, when the sketch starts
{
Serial.begin(9600);
pinMode(Ignitor, OUTPUT);
pinMode(Solenoid, OUTPUT);
}
//-------------------------------------------------------------------------------\
void loop() // run over and over again
{
Ignition_();
//ThermocoupleTest_();
delay(20000);
}
//-------------------------------------------------------------------------------\
void Ignition_()
{
Serial.println();
Serial.print("Start Ignition sequence no: ");
Serial.print(IgnitionStarts);
Serial.println();
BeforeFlameOn=analogRead(0);
Serial.print("Low flame reading: ");
Serial.print(BeforeFlameOn);
//condition 1
if (analogRead(0)>150)
{
Serial.println();
Serial.print("Flame is on or thermocouple is cooling down");
Serial.println();
Serial.print("Ignition sequence stopped- 15sec cool down started");
Serial.println();
delay(15000);
return;
}
else
{
Serial.println();
Serial.print("Open gas valve");
digitalWrite(Solenoid,HIGH);
Serial.println();
delay(500);
Serial.print("Ignitor started");
Serial.println();
digitalWrite(Ignitor, HIGH);
delay(700);
Serial.print("Ignitor switched off");
Serial.println();
digitalWrite(Ignitor, LOW);
}
delay(1000);
AfterFlameOn=analogRead(0);
Serial.print("High flame reading: ");
Serial.print(AfterFlameOn);
Serial.println();
//condition 2
if (AfterFlameOn>BeforeFlameOn+50)
{
Serial.print("Flame Detected");
Serial.println();
}
else
{
digitalWrite(Solenoid,LOW); // switch off solenoid
Serial.print("Ignition sequence aborted- Flame not detected");
Serial.println();
IgnitionStarts++;
return;
}
//condition 3
if (BeforeFlameOn>150)
{
Serial.print("Flame is on or thermocouple is cooling down");
Serial.println();
Serial.print("Ignition sequence stopped");
Serial.println();
return;
}
}
//-------------------------------------------------------------------------------\
void ThermocoupleTest_()
{
for (int x=0; x<5000; x++)
{
BeforeFlameOn=analogRead(0);
Serial.println();
Serial.print("x= ");
Serial.print(x);
Serial.print("\t");
Serial.print(analogRead(0));
Serial.print("\t");
Serial.print(BeforeFlameOn);
}
}