Hi I'm developing beacon firmware using ble_app_beacon example code.
I was able to send good beacon data for my purpose. For the next step, I want to turn on the LED which is connected to Pin 18 for 60 seconds and turn-off to show that the beacon is working fine and turns-off to save the battery.
However it is hard to set the app_timer function. I tried to use while loop for 60 seconds to turn set the pin18 GPIO configuration to high and set it to low after 60 seconds.
Could you help me with this by providing example code that i can modify or some function?
My main code is below, right now my LED is turned on continuously.
int main(void) { // Set the external high frequency clock source to 32 MHz NRF_CLOCK->XTALFREQ = 0xFFFFFF00; // Start the external high frequency crystal NRF_CLOCK->EVENTS_HFCLKSTARTED = 0; NRF_CLOCK->TASKS_HFCLKSTART = 1; // Wait for the external oscillator to start up while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0) {} //while (true) { } uint32_t err_code; // Initialize. err_code = NRF_LOG_INIT(NULL); APP_ERROR_CHECK(err_code); APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false); err_code = bsp_init(18, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL); // LED blinking in pin 18 (P18) APP_ERROR_CHECK(err_code); ble_stack_init(); advertising_init(); // Start execution. NRF_LOG_INFO("BLE Beacon started\r\n"); advertising_start(); /* bsp_board_led_on(18); nrf_delay_ms(1000); bsp_board_leds_init(); bsp_board_led_off(18); // turn off led 18 */ /* while(true) { nrf_gpio_pin_set(18); nrf_delay_ms(100); nrf_gpio_pin_clear(18); nrf_delay_ms(100); } */ // Enter main loop. for (;; ) { if (NRF_LOG_PROCESS() == false) { power_manage(); } } }