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

Configuration of Digital Input/Output pins on nRF52

Hello everybody, I'm new to the Nordic system and the nRF52. I'm trying to become familiar with the board and I want to be able to read different 4 input pins, each one attached to the LEDs. In few words, I'm looking to do something like this.

if(button_1 pressed)
{
 led_1=on;
}


if(button_2 pressed)
{
 led_2=on;
}


if(button_3 pressed)
{
 led_3=on;
}


if(button_4 pressed)
{
 led_4=on;
}

I have tried the example that comes with the SKD pin_change_int_pca10040. I have tried to modify the code with no luck. Any advice will be appreciate it.

Would I be able to use the following function to change the state of the pin from 0 to 1?

nrf_drv_gpiote_out_set

Also, will this one will change the state of the pin from 1 to 0

nrf_drv_gpiote_out_clear

How could I read the state change on the pin?

Thank you for your help

Related