Create a gist now

Instantly share code, notes, and snippets.

@neosarchizo /innocean.ino Secret
Last active Jan 31, 2018

Embed
What would you like to do?
[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