센서3 인체감지센서 아두이노 2022. 1. 18. 초음파센서 // --------------------------------------------------------------------------- // Example NewPing library sketch that does a ping about 20 times per second. // --------------------------------------------------------------------------- #include #define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor. #define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic.. 아두이노 2022. 1. 18. 온도, 습도 센서 (KY-015) int DHpin = 8; // input/output pin byte dat[5]; byte read_data() { byte i = 0; byte result = 0; for (i = 0; i < 8; i++) { while (digitalRead(DHpin) == LOW); // wait 50us delayMicroseconds(30); //The duration of the high level is judged to determine whether the data is '0' or '1' if (digitalRead(DHpin) == HIGH) result |= (1 아두이노 2022. 1. 17. 이전 1 다음