Skip to content

Instantly share code, notes, and snippets.

@neosarchizo
Last active January 31, 2018 06:55
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 neosarchizo/c9ad9fa062d0885b807669726cfdd96f to your computer and use it in GitHub Desktop.
Save neosarchizo/c9ad9fa062d0885b807669726cfdd96f to your computer and use it in GitHub Desktop.
[201801-N-C10] 이노션 - 공기질 측정기
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 16, 2);
void setup() {
lcd.init();
lcd.backlight();
}
void loop() {
lcd.clear();
lcd.setCursor(0,0);
lcd.print("INNOCEAN");
lcd.setCursor(0, 1);
lcd.print("DUST : ");
float value = 0;
float dustDensity = 0;
pinMode(2, OUTPUT);
digitalWrite(2, LOW);
delayMicroseconds(280);
value = analogRead(0);
delayMicroseconds(40);
digitalWrite(2, HIGH);
delayMicroseconds(9680);
dustDensity = 0.17 * value * (5.0 / 1024.0);
dustDensity = dustDensity * 1000;
lcd.print(dustDensity);
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment