From a999a1815b5280f5c8a75f9732066c157be9ff29 Mon Sep 17 00:00:00 2001 From: miguel5612 Date: Wed, 14 Aug 2019 22:02:25 -0500 Subject: [PATCH] Updated all examples, new edition V3.00 --- examples/MQ-131/MQ-131.ino | 22 +++++++++++++++++----- examples/MQ-135/MQ-135.ino | 31 +++++++++++++++++++++++-------- examples/MQ-2/MQ-2.ino | 31 +++++++++++++++++++++++-------- examples/MQ-303A/MQ303.ino | 24 ++++++++++++++++++------ examples/MQ-4/MQ-4.ino | 29 +++++++++++++++++++++-------- examples/MQ-5/MQ-5.ino | 32 +++++++++++++++++++++++--------- examples/MQ-6/MQ-6.ino | 30 ++++++++++++++++++++++-------- examples/MQ-7/MQ-7.ino | 29 +++++++++++++++++++++-------- examples/MQ-8/MQ-8.ino | 29 +++++++++++++++++++++-------- examples/MQ-9/MQ-9.ino | 23 +++++++++++++++++------ 10 files changed, 206 insertions(+), 74 deletions(-) diff --git a/examples/MQ-131/MQ-131.ino b/examples/MQ-131/MQ-131.ino index eeb4039..c750e2e 100644 --- a/examples/MQ-131/MQ-131.ino +++ b/examples/MQ-131/MQ-131.ino @@ -21,9 +21,11 @@ #define type 131 //MQ131 //Declare Sensor - MQUnifiedsensor MQ131(pin, type); +//Variables +float NOx, CL2, O3; + void setup() { //init the sensor /***************************** MQInicializar**************************************** @@ -35,6 +37,7 @@ void setup() { } void loop() { + MQ131.update(); // Update data, the arduino will be read the voltaje in the analog pin /***************************** MQReadSensor **************************************** Input: Gas - Serial print flag Output: Value in PPM @@ -42,9 +45,18 @@ void loop() { ************************************************************************************/ //Read the sensor and print in serial port //Lecture will be saved in lecture variable - int lecture = MQ131.readSensor("", true); // Return O3 concentration + //float lecture = MQ131.readSensor("", true); // Return O3 concentration // Options, uncomment where you need - //int lecture = MQ131.readSensor("NOx", true); // Return NOx concentration - //int lecture = MQ131.readSensor("CL2", true); // Return CL2 concentration - //int lecture = MQ131.readSensor("O3", true); // Return O3 concentration + NOx = MQ131.readSensor("NOx"); // Return NOx concentration + CL2 = MQ131.readSensor("CL2"); // Return CL2 concentration + O3 = MQ131.readSensor("O3"); // Return O3 concentration + + Serial.println("***************************"); + Serial.println("Lectures for MQ-131"); + Serial.print("Volt: ");Serial.print(MQ9.getVoltage(false));Serial.println(" V"); + Serial.print("R0: ");Serial.print(MQ9.getR0());Serial.println(" Ohm"); + Serial.print("NOx: ");Serial.print(NOx,2);Serial.println(" ppm"); + Serial.print("CL2: ");Serial.print(CL2,2);Serial.println(" ppm"); + Serial.print("O3: ");Serial.print(O3,2);Serial.println(" ppm"); + Serial.println("***************************"); } diff --git a/examples/MQ-135/MQ-135.ino b/examples/MQ-135/MQ-135.ino index 694e844..5fe43d2 100644 --- a/examples/MQ-135/MQ-135.ino +++ b/examples/MQ-135/MQ-135.ino @@ -21,9 +21,11 @@ #define type 135 //MQ135 //Declare Sensor - MQUnifiedsensor MQ135(pin, type); +//Variables +float CO, Alcohol, CO2, Tolueno, NH4, Acetona; + void setup() { //init the sensor /***************************** MQInicializar**************************************** @@ -35,6 +37,7 @@ void setup() { } void loop() { + MQ135.update(); // Update data, the arduino will be read the voltaje in the analog pin /***************************** MQReadSensor **************************************** Input: Gas - Serial print flag Output: Value in PPM @@ -42,12 +45,24 @@ void loop() { ************************************************************************************/ //Read the sensor and print in serial port //Lecture will be saved in lecture variable - int lecture = MQ135.readSensor("", true); // Return NH4 concentration + //float lecture = MQ135.readSensor("", true); // Return NH4 concentration // Options, uncomment where you need - //int lecture = MQ135.readSensor("CO", true); // Return CO concentration - //int lecture = MQ135.readSensor("Alcohol", true); // Return Alcohol concentration - //int lecture = MQ135.readSensor("CO2", true); // Return CO2 concentration - //int lecture = MQ135.readSensor("Tolueno", true); // Return Tolueno concentration - //int lecture = MQ135.readSensor("NH4", true); // Return NH4 concentration - //int lecture = MQ135.readSensor("Acetona", true); // Return Acetona concentration + CO = MQ135.readSensor("CO"); // Return CO concentration + Alcohol = MQ135.readSensor("Alcohol"); // Return Alcohol concentration + CO2 = MQ135.readSensor("CO2"); // Return CO2 concentration + Tolueno = MQ135.readSensor("Tolueno"); // Return Tolueno concentration + NH4 = MQ135.readSensor("NH4"); // Return NH4 concentration + Acetona = MQ135.readSensor("Acetona"); // Return Acetona concentration + + Serial.println("***************************"); + Serial.println("Lectures for MQ-135"); + Serial.print("Volt: ");Serial.print(MQ8.getVoltage(false));Serial.println(" V"); + Serial.print("R0: ");Serial.print(MQ8.getR0());Serial.println(" Ohm"); + Serial.print("CO: ");Serial.print(CO,2);Serial.println(" ppm"); + Serial.print("Alcohol: ");Serial.print(Alcohol,2);Serial.println(" ppm"); + Serial.print("CO2: ");Serial.print(CO2,2);Serial.println(" ppm"); + Serial.print("Tolueno: ");Serial.print(Tolueno,2);Serial.println(" ppm"); + Serial.print("NH4: ");Serial.print(NH4,2);Serial.println(" ppm"); + Serial.print("Acetona: ");Serial.print(Acetona,2);Serial.println(" ppm"); + Serial.println("***************************"); } diff --git a/examples/MQ-2/MQ-2.ino b/examples/MQ-2/MQ-2.ino index 0b4951f..a482bff 100644 --- a/examples/MQ-2/MQ-2.ino +++ b/examples/MQ-2/MQ-2.ino @@ -23,6 +23,9 @@ //Declare Sensor MQUnifiedsensor MQ2(pin, type); +//Variables +float H2, LPG, CO, Alcohol, Propane, Benzene; + void setup() { //Init serial port Serial.begin(115200); @@ -36,6 +39,7 @@ void setup() { } void loop() { + MQ2.update(); // Update data, the arduino will be read the voltaje in the analog pin /***************************** MQReadSensor **************************************** Input: Gas - Serial print flag Output: Value in PPM @@ -43,13 +47,24 @@ void setup() { ************************************************************************************/ //Read the sensor and print in serial port //Lecture will be saved in lecture variable - int lecture = MQ2.readSensor("", true); // Return LPG concentration + //float lecture = MQ2.readSensor("", true); // Return LPG concentration // Options, uncomment where you need - //int lecture = MQ2.readSensor("H2", true); // Return H2 concentration - //int lecture = MQ2.readSensor("LPG", true); // Return LPG concentration - //int lecture = MQ2.readSensor("CO", true); // Return CO concentration - //int lecture = MQ2.readSensor("Alcohol", true); // Return Alcohol concentration - //int lecture = MQ2.readSensor("Propane", true); // Return Propane concentration - //int lecture = MQ2.readSensor("Benzene", true); // Return Benzene concentration - delay(400); + H2 = MQ2.readSensor("H2"); // Return H2 concentration + LPG = MQ2.readSensor("LPG"); // Return LPG concentration + CO = MQ2.readSensor("CO"); // Return CO concentration + Alcohol = MQ2.readSensor("Alcohol"); // Return Alcohol concentration + Propane = MQ2.readSensor("Propane"); // Return Propane concentration + Benzene = MQ2.readSensor("Benzene"); // Return Benzene concentration + + Serial.println("***************************"); + Serial.println("Lectures for MQ-2"); + Serial.print("Volt: ");Serial.print(MQ2.getVoltage(false));Serial.println(" V"); + Serial.print("R0: ");Serial.print(MQ2.getR0());Serial.println(" Ohm"); + Serial.print("H2: ");Serial.print(H2,2);Serial.println(" ppm"); + Serial.print("LPG: ");Serial.print(LPG,2);Serial.println(" ppm"); + Serial.print("CO: ");Serial.print(CO,2);Serial.println(" ppm"); + Serial.print("Alcohol: ");Serial.print(Alcohol,2);Serial.println(" ppm"); + Serial.print("Propane: ");Serial.print(Propane,2);Serial.println(" ppm"); + Serial.print("Benzene: ");Serial.print(Benzene,2);Serial.println(" ppm"); + Serial.println("***************************"); } diff --git a/examples/MQ-303A/MQ303.ino b/examples/MQ-303A/MQ303.ino index 7d9cd18..3e910af 100644 --- a/examples/MQ-303A/MQ303.ino +++ b/examples/MQ-303A/MQ303.ino @@ -21,9 +21,11 @@ #define type 303 //MQ303 //Declare Sensor - MQUnifiedsensor MQ303(pin, type); +//Variables +float Iso_butano, Hydrogeno, Ethanol; + void setup() { //init the sensor /***************************** MQInicializar**************************************** @@ -35,6 +37,7 @@ void setup() { } void loop() { + MQ303.update(); /***************************** MQReadSensor **************************************** Input: Gas - Serial print flag Output: Value in PPM @@ -42,10 +45,19 @@ void loop() { ************************************************************************************/ //Read the sensor and print in serial port //Lecture will be saved in lecture variable - int lecture = MQ303.readSensor("", true); // Return Isobutano concentration + //float lecture = MQ303.readSensor("", true); // Return Isobutano concentration // Options, uncomment where you need - //int lecture = MQ303.readSensor("Iso_butano", true); // Return Iso_butano concentration - //int lecture = MQ303.readSensor("Hydrogeno", true); // Return Hydrogeno concentration - //int lecture = MQ303.readSensor("Ethanol", true); // Return Ethanol concentration - delay(400); + Iso_butano = MQ303.readSensor("Iso_butano"); // Return Iso_butano concentration + Hydrogeno = MQ303.readSensor("Hydrogeno"); // Return Hydrogeno concentration + Ethanol = MQ303.readSensor("Ethanol"); // Return Ethanol concentration + + Serial.println("***************************"); + Serial.println("Lectures for MQ-135"); + Serial.print("Volt: ");Serial.print(MQ8.getVoltage(false));Serial.println(" V"); + Serial.print("R0: ");Serial.print(MQ8.getR0());Serial.println(" Ohm"); + Serial.print("Iso_butano: ");Serial.print(Iso_butano,2);Serial.println(" ppm"); + Serial.print("Hydrogeno: ");Serial.print(Hydrogeno,2);Serial.println(" ppm"); + Serial.print("Ethanol: ");Serial.print(Ethanol,2);Serial.println(" ppm"); + Serial.println("***************************"); + } diff --git a/examples/MQ-4/MQ-4.ino b/examples/MQ-4/MQ-4.ino index d8aa02d..629a30a 100644 --- a/examples/MQ-4/MQ-4.ino +++ b/examples/MQ-4/MQ-4.ino @@ -21,9 +21,11 @@ #define type 4 //MQ4 //Declare Sensor - MQUnifiedsensor MQ4(pin, type); +//Variables +float CH4, LPG, CO, Alcohol, smoke; + void setup() { //init the sensor /***************************** MQInicializar**************************************** @@ -35,6 +37,7 @@ void setup() { } void loop() { + MQ4.update(); // Update data, the arduino will be read the voltaje in the analog pin /***************************** MQReadSensor **************************************** Input: Gas - Serial print flag Output: Value in PPM @@ -42,12 +45,22 @@ void loop() { ************************************************************************************/ //Read the sensor and print in serial port //Lecture will be saved in lecture variable - int lecture = MQ4.readSensor("", true); // Return CH4 concentration + //float lecture = MQ4.readSensor("", true); // Return CH4 concentration // Options, uncomment where you need - //int lecture = MQ4.readSensor("CH4", true); // Return CH4 concentration - //int lecture = MQ4.readSensor("LPG", true); // Return LPG concentration - //int lecture = MQ4.readSensor("CO", true); // Return CO concentration - //int lecture = MQ4.readSensor("Alcohol", true); // Return Alcohol concentration - //int lecture = MQ4.readSensor("smoke", true); // Return smoke concentration - delay(400); + CH4 = MQ4.readSensor("CH4"); // Return CH4 concentration + LPG = MQ4.readSensor("LPG"); // Return LPG concentration + CO = MQ4.readSensor("CO"); // Return CO concentration + Alcohol = MQ4.readSensor("Alcohol"); // Return Alcohol concentration + smoke = MQ4.readSensor("smoke"); // Return smoke concentration + + Serial.println("***************************"); + Serial.println("Lectures for MQ-4"); + Serial.print("Volt: ");Serial.print(MQ4.getVoltage(false));Serial.println(" V"); + Serial.print("R0: ");Serial.print(MQ4.getR0());Serial.println(" Ohm"); + Serial.print("CH4: ");Serial.print(CH4,2);Serial.println(" ppm"); + Serial.print("LPG: ");Serial.print(LPG,2);Serial.println(" ppm"); + Serial.print("CO: ");Serial.print(CO,2);Serial.println(" ppm"); + Serial.print("Alcohol: ");Serial.print(Alcohol,2);Serial.println(" ppm"); + Serial.print("smoke: ");Serial.print(smoke,2);Serial.println(" ppm"); + Serial.println("***************************"); } diff --git a/examples/MQ-5/MQ-5.ino b/examples/MQ-5/MQ-5.ino index 66f7fd4..c75dee5 100644 --- a/examples/MQ-5/MQ-5.ino +++ b/examples/MQ-5/MQ-5.ino @@ -18,12 +18,14 @@ //Definitions #define pin A0 //Analog input 0 of your arduino -#define type 5 //MQ4 +#define type 5 //MQ5 //Declare Sensor - MQUnifiedsensor MQ5(pin, type); +//Variables +float H2, LPG, CH4, CO, smoke; + void setup() { //init the sensor /***************************** MQInicializar**************************************** @@ -35,6 +37,8 @@ void setup() { } void loop() { + + MQ5.update(); // Update data, the arduino will be read the voltaje in the analog pin /***************************** MQReadSensor **************************************** Input: Gas - Serial print flag Output: Value in PPM @@ -42,12 +46,22 @@ void loop() { ************************************************************************************/ //Read the sensor and print in serial port //Lecture will be saved in lecture variable - int lecture = MQ5.readSensor("", true); // Return H2 concentration + //float lecture = MQ5.readSensor("", true); // Return H2 concentration // Options, uncomment where you need - //int lecture = MQ5.readSensor("H2", true); // Return H2 concentration - //int lecture = MQ5.readSensor("LPG", true); // Return LPG concentration - //int lecture = MQ5.readSensor("CH4", true); // Return CH4 concentration - //int lecture = MQ5.readSensor("CO", true); // Return CO concentration - //int lecture = MQ5.readSensor("smoke", true); // Return smoke concentration - delay(400); + H2 = MQ5.readSensor("H2"); // Return H2 concentration + LPG = MQ5.readSensor("LPG"); // Return LPG concentration + CH4 = MQ5.readSensor("CH4"); // Return CH4 concentration + CO = MQ5.readSensor("CO"); // Return CO concentration + smoke = MQ5.readSensor("smoke"); // Return smoke concentration + + Serial.println("***************************"); + Serial.println("Lectures for MQ-5"); + Serial.print("Volt: ");Serial.print(MQ5.getVoltage(false));Serial.println(" V"); + Serial.print("R0: ");Serial.print(MQ5.getR0());Serial.println(" Ohm"); + Serial.print("H2: ");Serial.print(H2,2);Serial.println(" ppm"); + Serial.print("LPG: ");Serial.print(LPG,2);Serial.println(" ppm"); + Serial.print("CH4: ");Serial.print(CH4,2);Serial.println(" ppm"); + Serial.print("CO: ");Serial.print(CO,2);Serial.println(" ppm"); + Serial.print("smoke: ");Serial.print(smoke,2);Serial.println(" ppm"); + Serial.println("***************************"); } diff --git a/examples/MQ-6/MQ-6.ino b/examples/MQ-6/MQ-6.ino index ca08b98..1c143d5 100644 --- a/examples/MQ-6/MQ-6.ino +++ b/examples/MQ-6/MQ-6.ino @@ -18,12 +18,14 @@ //Definitions #define pin A0 //Analog input 0 of your arduino -#define type 6 //MQ4 +#define type 6 //MQ6 //Declare Sensor - MQUnifiedsensor MQ6(pin, type); +//Variables +float H2, LPG, CH4, CO, Alcohol; + void setup() { //init the sensor /***************************** MQInicializar**************************************** @@ -35,6 +37,7 @@ void setup() { } void loop() { + MQ6.update(); // Update data, the arduino will be read the voltaje in the analog pin /***************************** MQReadSensor **************************************** Input: Gas - Serial print flag Output: Value in PPM @@ -42,11 +45,22 @@ void loop() { ************************************************************************************/ //Read the sensor and print in serial port //Lecture will be saved in lecture variable - int lecture = MQ6.readSensor("", true); // Return CH4 concentration + //float lecture = MQ6.readSensor("", true); // Return CH4 concentration // Options, uncomment where you need - //int lecture = MQ6.readSensor("H2", true); // Return H2 concentration - //int lecture = MQ6.readSensor("LPG", true); // Return LPG concentration - //int lecture = MQ6.readSensor("CH4", true); // Return CH4 concentration - //int lecture = MQ6.readSensor("CO", true); // Return CO concentration - //int lecture = MQ6.readSensor("Alcohol", true); // Return Alcohol concentration + H2 = MQ6.readSensor("H2"); // Return H2 concentration + LPG = MQ6.readSensor("LPG"); // Return LPG concentration + CH4 = MQ6.readSensor("CH4"); // Return CH4 concentration + CO = MQ6.readSensor("CO"); // Return CO concentration + Alcohol = MQ6.readSensor("Alcohol"); // Return Alcohol concentration + + Serial.println("***************************"); + Serial.println("Lectures for MQ-6"); + Serial.print("Volt: ");Serial.print(MQ6.getVoltage(false));Serial.println(" V"); + Serial.print("R0: ");Serial.print(MQ6.getR0());Serial.println(" Ohm"); + Serial.print("H2: ");Serial.print(H2,2);Serial.println(" ppm"); + Serial.print("LPG: ");Serial.print(LPG,2);Serial.println(" ppm"); + Serial.print("CH4: ");Serial.print(CH4,2);Serial.println(" ppm"); + Serial.print("CO: ");Serial.print(CO,2);Serial.println(" ppm"); + Serial.print("Alcohol: ");Serial.print(Alcohol,2);Serial.println(" ppm"); + Serial.println("***************************"); } diff --git a/examples/MQ-7/MQ-7.ino b/examples/MQ-7/MQ-7.ino index c21299b..bda7d86 100644 --- a/examples/MQ-7/MQ-7.ino +++ b/examples/MQ-7/MQ-7.ino @@ -24,9 +24,11 @@ //Declare Sensor - MQUnifiedsensor MQ7(pin, type); +//Variables +float H2, LPG, CH4, CO, Alcohol; + void setup() { //init the sensor /***************************** MQInicializar**************************************** @@ -38,6 +40,7 @@ void setup() { } void loop() { + MQ7.update(); // Update data, the arduino will be read the voltaje in the analog pin /***************************** MQReadSensor **************************************** Input: Gas - Serial print flag Output: Value in PPM @@ -45,12 +48,22 @@ void loop() { ************************************************************************************/ //Read the sensor and print in serial port //Lecture will be saved in lecture variable - int lecture = MQ7.readSensor("", true); // Return CH4 concentration + //float lecture = MQ7.readSensor("", true); // Return CH4 concentration // Options, uncomment where you need - //int lecture = MQ7.readSensor("H2", true); // Return CH4 concentration - //int lecture = MQ7.readSensor("LPG", true); // Return LPG concentration - //int lecture = MQ7.readSensor("CH4", true); // Return CH4 concentration - //int lecture = MQ7.readSensor("CO", true); // Return CO concentration - //int lecture = MQ7.readSensor("Alcohol", true); // Return Alcohol concentration - delay(400); + H2 = MQ7.readSensor("H2"); // Return CH4 concentration + LPG = MQ7.readSensor("LPG"); // Return LPG concentration + CH4 = MQ7.readSensor("CH4"); // Return CH4 concentration + CO = MQ7.readSensor("CO"); // Return CO concentration + Alcohol = MQ7.readSensor("Alcohol"); // Return Alcohol concentration + + Serial.println("***************************"); + Serial.println("Lectures for MQ-7"); + Serial.print("Volt: ");Serial.print(MQ7.getVoltage(false));Serial.println(" V"); + Serial.print("R0: ");Serial.print(MQ7.getR0());Serial.println(" Ohm"); + Serial.print("H2: ");Serial.print(H2,2);Serial.println(" ppm"); + Serial.print("LPG: ");Serial.print(LPG,2);Serial.println(" ppm"); + Serial.print("CH4: ");Serial.print(CH4,2);Serial.println(" ppm"); + Serial.print("CO: ");Serial.print(CO,2);Serial.println(" ppm"); + Serial.print("Alcohol: ");Serial.print(Alcohol,2);Serial.println(" ppm"); + Serial.println("***************************"); } diff --git a/examples/MQ-8/MQ-8.ino b/examples/MQ-8/MQ-8.ino index ccc6869..ac18090 100644 --- a/examples/MQ-8/MQ-8.ino +++ b/examples/MQ-8/MQ-8.ino @@ -21,9 +21,11 @@ #define type 8 //MQ8 //Declare Sensor - MQUnifiedsensor MQ8(pin, type); +//Variables +float H2, LPG, CH4, CO, Alcohol; + void setup() { //init the sensor /***************************** MQInicializar**************************************** @@ -35,6 +37,7 @@ void setup() { } void loop() { + MQ8.update(); // Update data, the arduino will be read the voltaje in the analog pin /***************************** MQReadSensor **************************************** Input: Gas - Serial print flag Output: Value in PPM @@ -42,12 +45,22 @@ void loop() { ************************************************************************************/ //Read the sensor and print in serial port //Lecture will be saved in lecture variable - int lecture = MQ8.readSensor("", true); // Return H2 concentration + //float lecture = MQ8.readSensor("", true); // Return H2 concentration // Options, uncomment where you need - //int lecture = MQ8.readSensor("H2", true); // Return CH4 concentration - //int lecture = MQ8.readSensor("LPG", true); // Return LPG concentration - //int lecture = MQ8.readSensor("CH4", true); // Return CH4 concentration - //int lecture = MQ8.readSensor("CO", true); // Return CO concentration - //int lecture = MQ8.readSensor("Alcohol", true); // Return Alcohol concentration - delay(400); + H2 = MQ8.readSensor("H2"); // Return CH4 concentration + LPG = MQ8.readSensor("LPG"); // Return LPG concentration + CH4 = MQ8.readSensor("CH4"); // Return CH4 concentration + CO = MQ8.readSensor("CO"); // Return CO concentration + Alcohol = MQ8.readSensor("Alcohol"); // Return Alcohol concentration + + Serial.println("***************************"); + Serial.println("Lectures for MQ-8"); + Serial.print("Volt: ");Serial.print(MQ8.getVoltage(false));Serial.println(" V"); + Serial.print("R0: ");Serial.print(MQ8.getR0());Serial.println(" Ohm"); + Serial.print("H2: ");Serial.print(H2,2);Serial.println(" ppm"); + Serial.print("LPG: ");Serial.print(LPG,2);Serial.println(" ppm"); + Serial.print("CH4: ");Serial.print(CH4,2);Serial.println(" ppm"); + Serial.print("CO: ");Serial.print(CO,2);Serial.println(" ppm"); + Serial.print("Alcohol: ");Serial.print(Alcohol,2);Serial.println(" ppm"); + Serial.println("***************************"); } diff --git a/examples/MQ-9/MQ-9.ino b/examples/MQ-9/MQ-9.ino index cbb8842..9a55410 100644 --- a/examples/MQ-9/MQ-9.ino +++ b/examples/MQ-9/MQ-9.ino @@ -21,9 +21,11 @@ #define type 9 //MQ9 //Declare Sensor - MQUnifiedsensor MQ9(pin, type); +//Variables +float CO, CH4, LPG; + void setup() { //init the sensor /***************************** MQInicializar**************************************** @@ -35,6 +37,7 @@ void setup() { } void loop() { + MQ9.update(); // Update data, the arduino will be read the voltaje in the analog pin /***************************** MQReadSensor **************************************** Input: Gas - Serial print flag Output: Value in PPM @@ -42,10 +45,18 @@ void loop() { ************************************************************************************/ //Read the sensor and print in serial port //Lecture will be saved in lecture variable - int lecture = MQ8.readSensor("", true); // Return LPG concentration + //float lecture = MQ9.readSensor("", true); // Return LPG concentration // Options, uncomment where you need - //int lecture = MQ8.readSensor("LPG", true); // Return LPG concentration - //int lecture = MQ8.readSensor("CH4", true); // Return CH4 concentration - //int lecture = MQ8.readSensor("CO", true); // Return CO concentration - delay(400); + LPG = MQ9.readSensor("LPG"); // Return LPG concentration + CH4 = MQ9.readSensor("CH4"); // Return CH4 concentration + CO = MQ9.readSensor("CO"); // Return CO concentration + + Serial.println("***************************"); + Serial.println("Lectures for MQ-9"); + Serial.print("Volt: ");Serial.print(MQ9.getVoltage(false));Serial.println(" V"); + Serial.print("R0: ");Serial.print(MQ9.getR0());Serial.println(" Ohm"); + Serial.print("CO: ");Serial.print(CO,2);Serial.println(" ppm"); + Serial.print("LPG: ");Serial.print(LPG,2);Serial.println(" ppm"); + Serial.print("CH4: ");Serial.print(CH4,2);Serial.println(" ppm"); + Serial.println("***************************"); }