Hello,
I want to use timer with my app. I want to make led on my beacon flash for 1 second when it recieves a value. How can i set timer to turn of led after 1 sec?
I'm using dual mode example, with RTC timer.
Hello,
I want to use timer with my app. I want to make led on my beacon flash for 1 second when it recieves a value. How can i set timer to turn of led after 1 sec?
I'm using dual mode example, with RTC timer.
are you asking how to use timer library?
Yes, sorry for not defining my question better. I'm using dual mode example, and finally managed to get leds to work like they should (on beacon pca20006 board). I'm using this RTC1.h file for timer. There are 2 functions rtc1_timeout_set_ms
and `rtc1_timeout. I made a function to turn on led with this timer for 500ms, then it should turn off. The problem is, led sometimes turns off and sometimes doesnt.
I made the function the same as it's defined in event_handle function.
my function:
static void ledice (void)
{
rtc1_timeout_set_ms(500);
while (!rtc1_timeout())
{
LEDS_INVERT(BSP_LED_0_MASK);
}
LEDS_INVERT(BSP_LED_0_MASK);
}
your function should look like this
static void ledice (void)
{
rtc1_timeout_set_ms(500);
LEDS_ON(BSP_LED_0_MASK);
while (!rtc1_timeout()) { }
LEDS_OFF(BSP_LED_0_MASK);
}
I think LEDS_ON will turn the led off, you can try to reverse the order in that case, you will notice that when the LED is off for 500 ms and then switches ON and stays ON
Ah yes. Works great when you changle LEDS_ON with LEDS_OFF and the other way around :)
Thank you very much for all your help today.
Best regards.