hello. I want to use the button as a pull-down.
I am using nrf52832, and the button and circuit part are composed of pull-down and the code is written as follows.
#define LED_RED 17
#define LED_GREEN 18
int main(void)
{
nrf_gpio_cfg_output(LED_RED);
nrf_gpio_cfg_output(LED_GREEN);
nrf_gpio_cfg_input(14, NRF_GPIO_PIN_PULLDOWN);
for(;;)
{
if(nrf_gpio_pin_read(14) == 1)
{
nrf_gpio_pin_clear(LED_RED);
nrf_gpio_pin_set(LED_GREEN);
}
else
{
nrf_gpio_pin_clear(LED_GREEN);
nrf_gpio_pin_set(LED_RED);
}
}
}
However, even if the button is pressed, it always behaves as 0.
I want to know why...
Ask for help.