How to add co,lpg,smoke,methane etc in mq2

hello guys. how can i add other harmful gasses in my gauge in blynk?
i want it to detect like 3 or 4 gasses but i dont know how. i can only detect smoke :frowning:

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space

char auth[] = "1BWJfzIRUtWnqiJPGPgfSj8ek7p4jX9T";

char ssid[] = "VIRUS";
char pass[] = "censored";
SimpleTimer timer;
int mq135 = A0; // smoke sensor is connected with the analog pin A0 
int data = 0; 
void setup() 
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(1000L, getSendData);
void loop() 
{; // Initiates SimpleTimer;
 * Send Sensor data to Blynk
void getSendData()
data = analogRead(mq135); 
  Blynk.virtualWrite(V2, data); //virtual pin V3
  if (data > 600 )
    Blynk.notify("Smoke Detected!!!"); 

@jamven10 please edit your post (using the pencil icon at the bottom) and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:


surething sir :slight_smile:

You’ve edited your post, but haven’t used the correct characters - even though I went to the trouble of providing you with some to copy and paste.


oops :sweat_smile:

Okay, to answer your question…

Obtain the sensors and wire them up, and get5 them working without Blynk - printing the readings to your serial monitor. If you use code taken from the internet for this then restructure it so that the void loop contains no more than your current void loop does. This means using a timer to poll the sensor(s) on a regular basis.

Once you have it working without Blynk then add-in the Blynk part of the code.