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

how to blink LED without using BSP library .for nrf52?

int main(void)
{
	  nrf_gpio_pin_dir_set(14,NRF_GPIO_PIN_DIR_INPUT);
	//nrf_gpio_cfg_sense_input(14,,0);
		uint32_t ret=nrf_gpio_pin_read(14);	
//	uint32_t ret=nrf_gpio_pin_sense_get(15);
  while (true)
    {
			if(ret==1)
			{
			nrf_gpio_pin_dir_set(17,NRF_GPIO_PIN_DIR_OUTPUT);
					nrf_gpio_pin_dir_set(18,NRF_GPIO_PIN_DIR_OUTPUT);
				
				nrf_delay_ms(500);
				
				nrf_gpio_pin_clear(18);
				
				//Delay(5);
				ret=0;
				nrf_gpio_pin_clear(17);
			//	nrf_delay(500);
			}	
			else
			{
				nrf_gpio_pin_clear(17);
				Delay(500);
			}
   // }
	//}
}

}

my code is this I am using nrf library as ret variable is using for input value of pin 14 which is button for nrf52

Related