Arduino-HomeKit-ESP8266
Arduino-HomeKit-ESP8266 copied to clipboard
multiple accessories example GPIO pins
trafficstars
Hi everyone i use switch and define pin GPIOs code all ok, but i try example 4 MultipleAccessories but dont know how connect dht 11 on board. I try ESP8266 board on GPIO 16, 5 and 4 but I did not get a good result.(reading remains constant and does not change with temperature) which pins should i use?
#define DHTPIN 5 // Digital pin connected to the DHT sensor #define DHTTYPE DHT22 // DHT 22 (AM2302)
void my_homekit_report() {
sensors_event_t event;
dht.temperature().getEvent(&event);
float temperature_value = event.temperature;
cha_temperature.value.float_value = temperature_value;
homekit_characteristic_notify(&cha_temperature, cha_temperature.value);
dht.humidity().getEvent(&event);
float h = event.relative_humidity;
cha_humidity.value.float_value = h;
homekit_characteristic_notify(&cha_humidity, cha_humidity.value);
LOG_D("t %.1f, h %.1f", temperature_value, h);
}
I used it like this