From d5106205fc90b6a661d4a8e592571a7c2a44748f Mon Sep 17 00:00:00 2001 From: miguel5612 Date: Tue, 9 Jul 2019 17:20:13 -0500 Subject: [PATCH] Added MQ-303, MQ-309 full example in comments --- examples/MQ-303A/MQ303.ino | 28 +++++++++++++++++++--------- examples/MQ-309A/MQ-309.ino | 29 ++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/examples/MQ-303A/MQ303.ino b/examples/MQ-303A/MQ303.ino index 0abb94a..7d9cd18 100644 --- a/examples/MQ-303A/MQ303.ino +++ b/examples/MQ-303A/MQ303.ino @@ -25,17 +25,27 @@ MQUnifiedsensor MQ303(pin, type); void setup() { - //init the sensor + //init the sensor + /***************************** MQInicializar**************************************** + Input: pin, type + Output: + Remarks: This function create the sensor object. + ************************************************************************************/ MQ303.inicializar(); } void loop() { - //Read the sensor - int read = MQ303.readSensor(); - //Print measurements - Serial.print("MQ303: "); - Serial.print(read); - Serial.println(" PPM"); - //delay 1s to next measure - delay(1000); + /***************************** MQReadSensor **************************************** + Input: Gas - Serial print flag + Output: Value in PPM + Remarks: This function use readPPM to read the value in PPM the gas in the air. + ************************************************************************************/ + //Read the sensor and print in serial port + //Lecture will be saved in lecture variable + int 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); } diff --git a/examples/MQ-309A/MQ-309.ino b/examples/MQ-309A/MQ-309.ino index d4b38c4..e51b8db 100644 --- a/examples/MQ-309A/MQ-309.ino +++ b/examples/MQ-309A/MQ-309.ino @@ -25,17 +25,28 @@ MQUnifiedsensor MQ309(pin, type); void setup() { - //init the sensor + //init the sensor + /***************************** MQInicializar**************************************** + Input: pin, type + Output: + Remarks: This function create the sensor object. + ************************************************************************************/ MQ309.inicializar(); } void loop() { - //Read the sensor - int read = MQ309.readSensor(); - //Print measurements - Serial.print("MQ309: "); - Serial.print(read); - Serial.println(" PPM"); - //delay 1s to next measure - delay(1000); + /***************************** MQReadSensor **************************************** + Input: Gas - Serial print flag + Output: Value in PPM + Remarks: This function use readPPM to read the value in PPM the gas in the air. + ************************************************************************************/ + //Read the sensor and print in serial port + //Lecture will be saved in lecture variable + int lecture = MQ309.readSensor("", true); // Return CO concentration + // Options, uncomment where you need + //int lecture = MQ309.readSensor("H2", true); // Return H2 concentration + //int lecture = MQ309.readSensor("CH4", true); // Return CH4 concentration + //int lecture = MQ309.readSensor("CO", true); // Return CO concentration + //int lecture = MQ309.readSensor("Alcohol", true); // Return Alcohol concentration + delay(400); }