Hello,
I just bought this Seeed Grove Flame Sensor:
seeedstudio.com/wiki/Grove_-_Flame_Sensor
Can I connect it directly to my Arduino Mega 2560, without using a Seeed Grove Base Shield?
And can I get analog feedback values from this sensor?
I just found a sample code, where I get a boolean feedback, if there is a flame detected or not.
I’d like to have a specific analog feedback value, where I get get information about how strong the value is.
This is the sample code:
#define FLAME_SENSOR 3 //connect FLAME_SENSOR to digital pin3
#define LED 2//connect Grove - LED to pin2
void setup()
{
pinsInit();
}
void loop()
{
if(isFlameDetected())
turnOnLED();
else turnOffLED();
}
/********************************/
void pinsInit()
{
pinMode(FLAME_SENSOR, INPUT);
pinMode(LED,OUTPUT);
digitalWrite(LED,LOW);
}
void turnOnLED()
{
digitalWrite(LED,HIGH);
}
void turnOffLED()
{
digitalWrite(LED,LOW);
}
boolean isFlameDetected()
{
if(digitalRead(FLAME_SENSOR))
return false;
else return true;
}
Best regards