Files
arduino/examples/PM2_SIMPLE/PM2_SIMPLE.ino

35 lines
808 B
Arduino
Raw Normal View History

/*
This is the code for the AirGradient DIY Air Quality Sensor with an ESP8266 Microcontroller.
It is a high quality sensor showing PM2.5, CO2, Temperature and Humidity on a small display and can send data over Wifi.
For build instructions please visit https://www.airgradient.com/diy/
Compatible with the following sensors:
Plantower PMS5003 (Fine Particle Sensor)
Please install ESP8266 board manager (tested with version 3.0.0)
If you are a school or university contact us for a free trial on the AirGradient platform.
https://www.airgradient.com/schools/
MIT License
*/
2020-07-24 21:52:28 +08:00
#include <AirGradient.h>
AirGradient ag = AirGradient();
void setup(){
Serial.begin(9600);
ag.PMS_Init();
}
void loop(){
int PM2 = ag.getPM2_Raw();
2020-07-24 21:52:28 +08:00
Serial.print("PM2: ");
Serial.println(ag.getPM2());
2020-07-24 21:52:28 +08:00
delay(5000);
}