Adds blinking LED test code
This commit is contained in:
1 parent
fcded7833c
commit
0d36183b99
4 files changed
+42
-5
No files matched your search
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"idf.adapterTargetName": "esp8266"
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#define MAX_HTTP_OUTPUT_BUFFER 2048
|
||||
|
||||
const char * TAG = "http_client.c";
|
||||
static const char * TAG = "http_client.c";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
#define DHT_GPIO 2 // D1 pin
|
||||
|
||||
const char * TAG = "main.c";
|
||||
|
||||
void wifi_init(void) {
|
||||
tcpip_adapter_init();
|
||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||
@@ -53,6 +55,36 @@ void temperature_task(void *arg)
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
*/
|
||||
|
||||
#include "driver/gpio.h"
|
||||
|
||||
#define LED1 GPIO_NUM_4
|
||||
#define LED2 GPIO_NUM_5
|
||||
|
||||
void blink_task(void *pvParameter)
|
||||
{
|
||||
gpio_set_direction(LED1,GPIO_MODE_OUTPUT);
|
||||
gpio_set_direction(LED2,GPIO_MODE_OUTPUT);
|
||||
|
||||
while (1) {
|
||||
ESP_LOGI(TAG, "Blink LEDs...");
|
||||
// Blink the LEDs
|
||||
gpio_set_level(LED1, 0);
|
||||
gpio_set_level(LED2, 0);
|
||||
vTaskDelay(500 / portTICK_PERIOD_MS);
|
||||
gpio_set_level(LED1, 0);
|
||||
gpio_set_level(LED2, 1);
|
||||
vTaskDelay(500 / portTICK_PERIOD_MS);
|
||||
gpio_set_level(LED1, 1);
|
||||
gpio_set_level(LED2, 0);
|
||||
vTaskDelay(500 / portTICK_PERIOD_MS);
|
||||
gpio_set_level(LED1, 1);
|
||||
gpio_set_level(LED2, 1);
|
||||
vTaskDelay(500 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void main_task(void* args) {
|
||||
float humidity = 0;
|
||||
float temperature = 0;
|
||||
@@ -79,9 +111,9 @@ void main_task(void* args) {
|
||||
|
||||
void app_main()
|
||||
{
|
||||
ESP_ERROR_CHECK(nvs_flash_init());
|
||||
//ESP_ERROR_CHECK(nvs_flash_init());
|
||||
|
||||
wifi_init();
|
||||
|
||||
xTaskCreate(main_task, "main task", 2048, NULL, tskIDLE_PRIORITY, NULL);
|
||||
//wifi_init();
|
||||
xTaskCreate(&blink_task, "blink_task", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
|
||||
//xTaskCreate(main_task, "main task", 2048, NULL, tskIDLE_PRIORITY, NULL);
|
||||
}
|
||||
Reference in new issue
Block a user