Skip to content

Commit abebc08

Browse files
committed
match readme to code
1 parent 4f57bf3 commit abebc08

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ DHT22 sensor;
2323
void setup() {
2424
Serial.begin(112500);
2525
sensor.setup(23);
26-
sensor.setCallback([](int8_t result) {
27-
if (result > 0) {
28-
Serial.printf("Temp: %.1f°C\nHumid: %.1f%%\n", sensor.getTemperature(), sensor.getHumidity());
29-
} else {
30-
Serial.printf("Sensor error: %s", sensor.getError());
31-
}
26+
sensor.onData([](float humid, float temp) {
27+
Serial.printf("Temp: %.1f°C\nHumid: %.1f%%\n", temp, humid);
28+
});
29+
sensor.onError([](uint8_t error) {
30+
Serial.printf("Error: %d-%s\n", error, sensor.getError());
3231
});
3332
}
3433

examples/DHT22/DHT22.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void setup() {
4040
Serial.begin(74880);
4141
sensor.setup(23); // pin 23 is DATA, RMT channel defaults to channel 0 and 1
4242
sensor.onData([](float humidity, float temperature) {
43-
Serial.printf("Temp: %g°C\nHumid: %g%%\n", temperature,humidity);
43+
Serial.printf("Temp: %g°C\nHumid: %g%%\n", temperature, humidity);
4444
});
4545
sensor.onError([](uint8_t error) {
4646
Serial.printf("Sensor error: %s", sensor.getError());

src/esp32DHT.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ extern "C" {
3535

3636
namespace esp32DHTInternals {
3737

38-
typedef std::function<void(float, float)> OnData_CB;
39-
typedef std::function<void(uint8_t)> OnError_CB;
38+
typedef std::function<void(float humid, float temp)> OnData_CB;
39+
typedef std::function<void(uint8_t error)> OnError_CB;
4040

4141
} // end namespace esp32DHTInternals
4242

0 commit comments

Comments
 (0)