Skip to content

Instantly share code, notes, and snippets.

@notsobad
Created December 16, 2018 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notsobad/f99f5fa820ba0046ae1e8805393dbb30 to your computer and use it in GitHub Desktop.
Save notsobad/f99f5fa820ba0046ae1e8805393dbb30 to your computer and use it in GitHub Desktop.
#include <PMS.h>
#include "PMS.h"
#include <SoftwareSerial.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
//SoftwareSerial Serial1(10, 11); // RX, TX
PMS pms(Serial);
PMS::DATA data;
void setup()
{
lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
//lcd.print("By notsobad");
lcd.print("PM1.0/2.5/10");
Serial.begin(9600); // GPIO1, GPIO3 (TX/RX pin on ESP-12E Development Board)
}
void loop()
{
if (pms.read(data))
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("PM1.0/2.5/10");
lcd.setCursor(0, 1);
lcd.print(data.PM_AE_UG_1_0);
lcd.print("/");
lcd.print(data.PM_AE_UG_2_5);
lcd.print("/");
lcd.print(data.PM_AE_UG_10_0);
delay(500);
}
//delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment