I've struggled to get the user button on the dongle to work for the last few days. Still no success. I took the blinky example and modify it a little bit with gpio calls. Looks like the statement nrf_gpio_pin_read(BUTTON_1) in the code always equals 1 regardless I push the button or not. What am I doing wrong?
#include <stdbool.h>
#include <stdint.h>
#include "boards.h"
#include "nrf_delay.h"
int main(void)
{
nrf_gpio_cfg_output(LED_3);
nrf_gpio_cfg_input(BUTTON_1, BUTTON_PULL);
for (;;) {
if (nrf_gpio_pin_read(BUTTON_1) == 1) {
nrf_gpio_pin_toggle(LED_3);
nrf_delay_ms(200);
}
else {
nrf_gpio_pin_write(LED_3, 1);
}
}
}
I've struggled to get the user button on the dongle to work for the last few days. Still no success. I took the blinky example and modify it a little bit with gpio calls. Looks like the statement nrf_gpio_pin_read(BUTTON_1) in the code always equals 1 regardless I push the button or not. What am I doing wrong?