MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / _readSensor

Method _readSensor

libraries/DHT12/DHT12.cpp:78–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76
77
78int DHT12::_readSensor()
79{
80 // GET CONNECTION
81 _wire->beginTransmission(DHT12_ADDRESS);
82 _wire->write(0);
83 int rv = _wire->endTransmission();
84 if (rv < 0) return rv;
85
86 // GET DATA
87 const uint8_t length = 5;
88 int bytes = _wire->requestFrom(DHT12_ADDRESS, length);
89
90 if (bytes == 0) return DHT12_ERROR_CONNECT;
91 if (bytes < length) return DHT12_MISSING_BYTES;
92
93 for (int i = 0; i < bytes; i++)
94 {
95 _bits[i] = _wire->read();
96 }
97
98 return bytes;
99}
100
101
102// -- END OF FILE --

Callers

nothing calls this directly

Calls 2

writeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected