KY-0151 온도, 습도 센서 (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 다음