Arduino-HomeKit-ESP8266 icon indicating copy to clipboard operation
Arduino-HomeKit-ESP8266 copied to clipboard

multiple accessories example GPIO pins

Open spooker42 opened this issue 2 years ago • 2 comments
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?

spooker42 avatar Feb 01 '23 14:02 spooker42

#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

densh1k avatar Feb 05 '23 12:02 densh1k