How to raise an interrupt from existing ADC

God Bless you guys for the wonderful endeavor you are living up to.

Novice, please …

This is my code:

adc = pyb.ADC(pyb.Pin(‘P6’))

#while (True):
if (adcread>250):
img = sensor.snapshot()

Do machine vision algorithms on the image here


I need the Cam to consume as less power as possible until ‘adcread’ is greater than 250.
Once ‘adcread’ becomes greater than 250, the while loop should work and, thereafter, when ‘adcread’ falls below the value of 250, the Cam should go back to low power mode.

I understand that interrupts can be of use here. But how to raise an interrupt from ADC which continuously raises and falls?

Or, is there any completely different approach to this, please?

BTW … I’m on H7, please.

I don’t think you can do that, there’s no sleep/wake on ADC at least not that I know of. Alternatively you could just put the cam in low power, wake up, check adc and back to low power etc…

while (true):
if (adc < 250):
do something else.

See the low power examples in Examples->19-Low-Power

Thank you very much for the quick response.