13 corresponds to motor wheels..7 corresponds to 12V DC Brushless fan..if it senses fire, it stops and the fan starts rotating thus extinguishing fire..
Here's a tip. Use constants.
const byte MOTOR = 13;
const byte FAN = 7;
const int UPPER_THRESHOLD = 400;
const int LOWER_THRESHOLD = 100;
if (val > UPPER_THRESHOLD)
digitalWrite (MOTOR, LOW);
digitalWrite (FAN, HIGH);
if (val < LOWER_THRESHOLD)
digitalWrite (MOTOR, HIGH);
digitalWrite (FAN, LOW);
i light a candle and take that upto certain level ( nearer to the sensor ) say 5cm, the reading shoots up to 900-1000...if the intensity gets lowered, the reading comes to 400-500..at this stage it cant differentiate between flame and brightness..
How do you lower a candle's intensity? You seem to be saying that the sensor reading goes up when a flame is near it. Isn't that what is supposed to happen?