Reputation: 77
I was writing a simple program for the led blink, the program was working fine with GPIO_NUM_2
but when the led pin num is changed to GPIO_NUM_2
the program started behave oddly, and I don't know why that is happening. Please explain what mistake I am making.
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
# define led1 GPIO_NUM_7
void task1(void* pvParametes){
gpio_reset_pin(led1);
gpio_set_direction(led1, GPIO_MODE_OUTPUT);
while (true)
{
gpio_set_level(led1, 1);
vTaskDelay(pdMS_TO_TICKS(1000));
gpio_set_level(led1, 0);
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
void app_main(void)
{
xTaskCreate(task1, "LedBlink", 4096, NULL, 1, NULL);
}
Upvotes: 0
Views: 192
Reputation: 78975
GPIOs 6 to 11 are usually connected to the SPI flash memory. If you try to use them for something else, the MCU can no longer read the program it is executing and will fail.
Upvotes: 1