11 years, 1 month ago.

How many timer object can I create?

Since it is using Timer3. Is there a maximum number of timer objects that I can declare? is each of objects totally independent with each other? Could someone explain the detail of this library related to timer module?

Question relating to:

1 Answer

11 years, 1 month ago.

You can create as many as you like, obviously within reason, in the end you will run out of memory. It also shouldnt impact performance, it is simply if you reset a timer it will store the current value of Timer3, and if you then read it, it will read the current value and substract the previously stored value. So as long as you have memory you can keep making new ones.

With things like ticker it becomes a bit harder to say. In principle still the same is true, however it needs to keep a list of all ticker 'events', and if a new one is added it should be placed in the correct location so it is all sorted (first one first, etc). If you have really many Tickers that run at high speed the need to keep the list sorted can become a significant overhead.

Accepted Answer