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.