Go Down

Topic: TimerOne Help (Read 925 times) previous topic - next topic

cakinson

Jun 06, 2019, 07:12 pm Last Edit: Jun 10, 2019, 09:35 pm by cakinson
Done.

PaulS

The TimerOne library makes it easy to manipulate timer 1. You can NOT have two instances of the TimerOne class.

You'll need to figure out some common factor between the times you want events to happen, and make the ONE callback do something every nth or mth time it is called.

For instance, you could have the callback triggered every 10000 microseconds, and, in the callback increment a counter and then decide what to to:

Code: [Select]
void theOneCallback()
{
   called++;

   if(called % 15 == 0)
   {
      blinkLED();
   }

   if(called % 23 == 0)
   {
      AlaMaMruczka();
   }
}
The art of getting good answers lies in asking good questions.

cakinson

And i need to delete from code yes ?

  Timer2.initialize(230000);
  Timer2.attachInterrupt(TET);

cakinson

Ok,

I do this:

volatile unsigned long called;

And i add your loop to the code, code is compiled but text from

void AlaMaMruczka(void)
{
Serial.println("Ala ma Mruczka");
}

didn't enter to the serial port monitor.

Go Up