0

I am making a project on ESP32. It reads certain sensor values, stores them in RTC memory and sends them by MQTT after a certain time. I wish that it transmits data immediately if there is a difference of, say 10 units, via an interrupt. I suppose this is not possible by GPIO interrupts and obviously not by a timer as I wish it to happen only if a condition is true and not periodically. I searched on the internet but couldn't find anything except GPIO and Timer interrupts.

I am working on Arduino IDE.

Is what I want possible and if yes, how. Please also give a certain example that is in Arduino language for me to study. Also, if it is possible using GPIO interrupts, please tell me how.

Thank you in advance

1
  • 1
    send it in loop()
    – Juraj
    Mar 26 at 6:53
0

There is no such thing as an "interrupt on a value changing" since that is something that only exists in software, and interrupts are things triggered by hardware.

All you can do is check the value in loop() and send the data if the value is above your threshold. If you want to wake from sleep then you will have to do that periodically through other means.

1
  • could one use the 32's low power co-cpu and an assembly routine to avoid the wakeup just to compute the difference?
    – dandavis
    Mar 31 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.