This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Using GPIO as button

Hello,

I am trying to understand how to use an external button. In the first stage I am trying to replace the functionality of button0 on the DK with a GPIO.

I took the peripheral\BSP example and made the following changes:

1. pca10056.h:

       I replaced the line:

       #define BUTTON_1       11

       with the following line:

       #define BUTTON_1 NRF_GPIO_PIN_MAP(1, 3)

2. main.c:

      Added the lines:

     #define newPin NRF_GPIO_PIN_MAP(1, 3)

     nrf_gpio_cfg_input(newPin, NRF_GPIO_PIN_PULLUP);

I expected that whenever I connect the 5V on the board to pin 1.3, the button press event will fire. But it doesn't.

Any advice?

Related