Sir,
We want to know about sample code of how to configure GPIO pins as output, and let we know how to include them for led toggling.
Sir,
We want to know about sample code of how to configure GPIO pins as output, and let we know how to include them for led toggling.
Hi,
You can configure and control GPIOs using the GPIO abstraction API.
Below is an example of how to toggle LED1 on the nRF52 DK every 1 second:
#include "nrf.h"
#include "nrf_gpio.h"
#include "nrf_delay.h"
#define LED1_PIN 17
int main (void)
{
nrf_gpio_cfg_output(LED1_PIN);
nrf_gpio_pin_clear(LED1_PIN);
while(1)
{
nrf_gpio_pin_toggle(LED1_PIN);
nrf_delay_ms(1000);
}
}
You can also have a look at GPIOTE, for more advanced GPIO controlling.
Best regards,
Jørgen
Hi,
You can configure and control GPIOs using the GPIO abstraction API.
Below is an example of how to toggle LED1 on the nRF52 DK every 1 second:
#include "nrf.h"
#include "nrf_gpio.h"
#include "nrf_delay.h"
#define LED1_PIN 17
int main (void)
{
nrf_gpio_cfg_output(LED1_PIN);
nrf_gpio_pin_clear(LED1_PIN);
while(1)
{
nrf_gpio_pin_toggle(LED1_PIN);
nrf_delay_ms(1000);
}
}
You can also have a look at GPIOTE, for more advanced GPIO controlling.
Best regards,
Jørgen
Thank you sir for your valuable answer.