-
-
Save neosarchizo/c9ad9fa062d0885b807669726cfdd96f to your computer and use it in GitHub Desktop.
[201801-N-C10] 이노션 - 공기질 측정기
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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