Skip to main content
1 of 3

How can I control blinking of led while in timer function?

When I am in the 30-second standby function, I want to turn the LED on and off at 5-second intervals. .How can I do what I want using the again read_counter() function? The problem here is that I am already in the timer function with the read_counter function.

Note:The read_counter() function increases every 1 millisecond with ISR COMPA vector.I tried many times and couldn't find a stable solution.Example,as if(read_counter()%1000) PORTB^=(1<<LED)

void wait_function()
    {

      timer_init();
      while(read_counter()<30000) //30 second wait 
      {

                                  //A LED blinking at 1 second intervals ???
       
      }

    
    }