mirror of
https://github.com/miguel5612/MQSensorsLib.git
synced 2025-03-25 10:10:01 +03:00
Added MQ-7 full example in comments
This commit is contained in:
parent
eeca1ac436
commit
ccb1cca484
@ -25,24 +25,31 @@
|
|||||||
|
|
||||||
//Declare Sensor
|
//Declare Sensor
|
||||||
|
|
||||||
MQUnifiedsensor MQ7
|
MQUnifiedsensor MQ7(pin, type);
|
||||||
(pin, type);
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
//init the sensor
|
//init the sensor
|
||||||
MQ7
|
/***************************** MQInicializar****************************************
|
||||||
.inicializar();
|
Input: pin, type
|
||||||
|
Output:
|
||||||
|
Remarks: This function create the sensor object.
|
||||||
|
************************************************************************************/
|
||||||
|
MQ7.inicializar();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
//Read the sensor
|
/***************************** MQReadSensor ****************************************
|
||||||
int read = MQ7
|
Input: Gas - Serial print flag
|
||||||
.readSensor();
|
Output: Value in PPM
|
||||||
//Print measurements
|
Remarks: This function use readPPM to read the value in PPM the gas in the air.
|
||||||
Serial.print("MQ7
|
************************************************************************************/
|
||||||
: ");
|
//Read the sensor and print in serial port
|
||||||
Serial.print(read);
|
//Lecture will be saved in lecture variable
|
||||||
Serial.println(" PPM");
|
int lecture = MQ7.readSensor("", true); // Return CH4 concentration
|
||||||
//delay 1s to next measure
|
// Options, uncomment where you need
|
||||||
delay(1000);
|
//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 CO concentration
|
||||||
|
//int lecture = MQ7.readSensor("CO", true); // Return Alcohol concentration
|
||||||
|
//int lecture = MQ7.readSensor("Alcohol", true); // Return smoke concentration
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user