Hi everyone ! ,
In my studies, I have a project where I use the MQ-2 gas sensor.
here is the program I use:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int ledPin = 13; // LED connected to digital pin 13
int sensorValue = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
void loop() {
// put your main code here, to run repeatedly:
sensorValue = analogRead(analogInPin);
// determine alarm status
if (sensorValue >= 250)
{
digitalWrite(ledPin, HIGH); // sets the LED on
}
else
{
digitalWrite(ledPin, LOW); // sets the LED off
}
// print the results to the serial monitor:
Serial.print("sensor = " );
Serial.println(sensorValue);
delay(750);
}
the program is to light a LED when the gas rate is greater than 250ppm.
But I have a problem;
that there is an equation for an analog value to a value ppm?
Then datasheet says that this sensor can capture several gas but I have only one value,
Can we have several value display simultaneously?
If someone has an MQ-2 program that works, I'm interested
thank you in advance
Jeremy