You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MQSensorsLib/examples/MQ-9/MQ-9.ino

42 lines
764 B
Arduino

6 years ago
/*
6 years ago
MQUnifiedsensor Library - reading an MQ9
6 years ago
6 years ago
Demonstrates the use a MQ9 sensor.
6 years ago
Library originally added 01 may 2019
by Miguel A Califa, Yersson Carrillo, Ghiordy Contreras, Mario Rodriguez
Added example
modified 23 May 2019
by Miguel Califa
This example code is in the public domain.
*/
//Include the library
#include <MQUnifiedsensor.h>
6 years ago
//Definitions
#define pin A0 //Analog input 0 of your arduino
6 years ago
#define type 9 //MQ9
6 years ago
//Declare Sensor
6 years ago
MQUnifiedsensor MQ9(pin, type);
6 years ago
void setup() {
//init the sensor
6 years ago
MQ9.inicializar();
}
void loop() {
6 years ago
//Read the sensor
6 years ago
int read = MQ9.readSensor();
6 years ago
//Print measurements
6 years ago
Serial.print("MQ9: ");
6 years ago
Serial.print(read);
Serial.println(" PPM");
//delay 1s to next measure
delay(1000);
}