Hello to everyone.
I´m trying to configure the buttons of my SDK nRF52 to turn on LEDs, but all the examples I´ve found here are using BSP_EVENT_HANDLER.
So, my question is: that is the only way to correctly configure the buttons or I can configure them as a simply C++ code? I mean, directly, with only the button´s name.
I got this:
#include "nrf.h"
#include "nrf_gpio.h"
#define LED1 17
#define BTN1 13
int main (void)
{
nrf_gpio_cfg_output(LED1);
nrf_gpio_pin_clear(LED1);
nrf_gpio_cfg_input(BTN1,NRF_GPIO_PIN_PULLDOWN);
nrf_gpio_pin_clear(BTN1);
while(1)
{
if(BTN1==true)
{
nrf_gpio_pin_toggle(LED1);
}
}
}
But it doesn´t work. I hope you can help me.