modified: firmware/main/include/http_client.h
modified: firmware/main/include/lib.h modified: firmware/main/src/http_client.c modified: firmware/main/src/main.c
This commit is contained in:
1 parent
13e6cf1032
commit
e950fcec8f
4 files changed
+68
-41
No files matched your search
@@ -54,22 +54,22 @@ void temperature_task(void *arg)
|
||||
}
|
||||
*/
|
||||
void main_task(void* args) {
|
||||
//ESP_ERROR_CHECK(dht_init(DHT_GPIO, false));
|
||||
//vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||
float humidity = 0;
|
||||
float temperature = 0;
|
||||
|
||||
ESP_ERROR_CHECK(dht_init(DHT_GPIO, false));
|
||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||
//Register device with Server
|
||||
unsigned id;
|
||||
hc_register(&id);
|
||||
while (1)
|
||||
{
|
||||
ESP_ERROR_CHECK(dht_init(DHT_GPIO, false));
|
||||
vTaskDelay(4000 / portTICK_PERIOD_MS);
|
||||
|
||||
if (dht_read_float_data(DHT_TYPE_DHT22, DHT_GPIO, &humidity, &temperature) == ESP_OK) {
|
||||
} else {
|
||||
printf("Fail to get dht temperature data\n");
|
||||
}
|
||||
|
||||
hc_send_sensor_data(humidity,temperature);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
hc_send_sensor_data(id,humidity,temperature);
|
||||
vTaskDelay(5000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user