IR Flame Sensor Help

Hello, I made a Firefigther Robot Car Autonomously. Details of it at the end of the post. I need help with the fire detection part. The fire sensors detect fire normally however I need it to detect it and move towards it , so it can extinguish it with a water pump. Also, speed has been an issue since sometimes it goes by the candle and it doesn't detect it.
My Flame detection code part:

int fireLeft = analogRead(upperLeftFire);
Serial.print(fireLeft);

int fireRight = analogRead(upperRightFire);
Serial.print(fireRight);

if(fireLeft>threshold)
{
set_Motorspeed(120,120);
go_Advance();
digitalWrite(pump,HIGH);
head.write(90);
}

else if(fireLeft = threshold)
{
set_Motorspeed(60,60);
go_Advance();
head.write(90);
delay(500);
/*digitalWrite(pump,LOW); */
}

else if (fireLeft <= 30 || fireRight <=30) {
stop_Stop();
}
else
{
set_Motorspeed(120,120);
go_Advance();
digitalWrite(pump,HIGH);
head.write(90);
}
}
I need a sample code that whenever it detects fire, it goes close to it and stops. Project details parts:
Arduino Mega
4DC Motors
12V Water Pump
5V Relay
L298N Motor Driver
LCD
2 Fire Sensors
UltraSonic and Servo
Buzzer

Thanks.

Please use code tags when posting code as per forum guidelines, and post complete sketches. Snippets are useless.

Do clearly describe the behaviour of the robot, and how it differs from what it should do.

Are you sure your flame sensors actually sense the flame? How to you know they detect it?

I'm using an LCD for it to display whenever the fire sensor goes high or low. I just looking for a way so that lets say the fire sensor senses a fire 20cm away, the bot will get closer but the fire sensor will still be high so it wont go low and go back to obstacle avoidance and just go the other way.

What does the data sheet tell you, I cannot see it as I could not find the link you posted! I cannot figure out what you should get, again the nice schematic, not a frizzy thing is just out of sight! More information will help you.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.