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

Led Flashing

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.

Parents
  • 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);
    }
    
Reply
  • 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);
    }
    
Children
No Data
Related