Analog alerting from a class without repeatedly calling a function?

Hi,

Suppose I want to monitor the voltage of a battery and get alerted when it goes below 11V.

I can write code within "loop" or create a function that is called from within "loop" at a timer interval that does this...

But as I have multiple of inputs I would like to make this more efficient...

Is there a way to write a class that monitors the analog input of a sensor and throws an alert when the analog value goes below a defined value without having to call a function of that class from "loop" repeatedly?

Thx,
Jeroen

Is there a way to write a class that monitors the analog input of a sensor and throws an alert when the analog value goes below a defined value without having to call a function of that class from “loop” repeatedly?

No. Somehow the class instances need to know that they need to do something.