#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "dht.h"
#define SENSOR_TYPE DHT_TYPE_DHT11
#define DHT_PIN GPIO_NUM_15
float umidade;
float temperatura;
void app_main (){
gpio_set_direction(DHT_PIN, GPIO_MODE_INPUT);
gpio_set_pull_mode(DHT_PIN, GPIO_PULLUP_ONLY);
vTaskDelay(1000 / portTICK_PERIOD_MS);
while(1){
dht_read_float_data(SENSOR_TYPE, DHT_PIN, &umidade, &temperatura);
vTaskDelay(1);
}
}
Loading
franzininho-wifi
franzininho-wifi