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-309A/MQ-309.ino

42 lines
780 B
Arduino

6 years ago
/*
6 years ago
MQUnifiedsensor Library - reading an MQ309
6 years ago
6 years ago
Demonstrates the use a MQ309 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 309 //MQ309
6 years ago
//Declare Sensor
6 years ago
MQUnifiedsensor MQ309(pin, type);
6 years ago
void setup() {
//init the sensor
6 years ago
MQ309.inicializar();
}
void loop() {
6 years ago
//Read the sensor
6 years ago
int read = MQ309.readSensor();
6 years ago
//Print measurements
6 years ago
Serial.print("MQ309: ");
6 years ago
Serial.print(read);
Serial.println(" PPM");
//delay 1s to next measure
delay(1000);
}