I am working on the basic code for monitoring the state of GPIO0 which is the input button. For printing the state of a button I am using ESP log file. The code is working properly on the console. GPIO0 is active high so on pressing the button it gives the value 0 and in the normal state, it gives 1.
But while I am printing the logs on putty the GPIO0 pin works in Active low mode. Which stops the working of the Button. If I give the 3.3V to the GPIO0 pin it detects.
So, the problem is in the Putty GPIO0 pin is working as active LOW.
Here I am attaching the code.
Code: Untitled.c Select all
void app_main()
{
PUSH_BUTTON = 0
gpio_config_t io_config;
io_config.pin_bit_mask = 1ULL << PUSH_BUTTON;
io_config.mode = GPIO_MODE_INPUT;
io_config.intr_type = GPIO_INTR_DISABLE;
gpio_config(&io_config);
while(1)
{
ESP_LOGI(TAG,"%d",gpio_get_level(PUSH_BUTTON));
}
}
Please help me with this.
