Page 248 - MDP2022-3
P. 248
lcd.print("humi = ");
lcd.print(h);
lcd.print("%");
delay(1000);
if(h > 60){
digitalWrite(11,HIGH);
}
if(h < 50){
digitalWrite(11,LOW);
}
}
# 인체감지센서
#define TRIG 9 //TRIG 핀 설정 (초음파 보내는 핀)
#define ECHO 8 //ECHO 핀 설정 (초음파 받는 핀)
#define LED 13
#define BOOZER 12
void setup() {
Serial.begin(9600);
pinMode(TRIG, OUTPUT);
pinMode(ECHO, INPUT);
pinMode(LED, OUTPUT);
pinMode(BOOZER, OUTPUT);
}
void loop()
{
long duration, distance;
digitalWrite(TRIG, LOW);