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-303A/MQ303.ino

42 lines
778 B
Arduino

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