mirror of
https://github.com/miguel5612/MQSensorsLib.git
synced 2025-07-02 02:11:04 +03:00
Added comments
This commit is contained in:
@ -20,18 +20,32 @@
|
||||
#define pin A0 //Analog input 0 of your arduino
|
||||
#define type 2 //MQ2
|
||||
|
||||
/***************************** MQInicializar****************************************
|
||||
Input: pin, type
|
||||
Output:
|
||||
Remarks: This function create the sensor object.
|
||||
************************************************************************************/
|
||||
//Declare Sensor
|
||||
|
||||
MQUnifiedsensor MQ2(pin, type);
|
||||
|
||||
void setup() {
|
||||
//Init serial port
|
||||
Serial.begin(115200);
|
||||
/***************************** MQInicializar****************************************
|
||||
Input:
|
||||
Output:
|
||||
Remarks: This function configure the pinMode
|
||||
************************************************************************************/
|
||||
//init the sensor
|
||||
MQ2.inicializar();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
void loop() {
|
||||
/***************************** 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
|
||||
int lecture = MQ2.readSensor("", true);
|
||||
delay(400);
|
||||
|
Reference in New Issue
Block a user