I am trying to figure out when I should be using an interrupt vs. just checking in loop(). I have a simple reed switch that I need to monitor and publish events based on the state change. I can easily do that inside loop(), but an interrupt sounds more appropriate.
So, I have been trying an interrupt, but it seems to have plenty of limitations. e.g. you have to declare variables that you change inside an interrupt as
Spark.variable doesn’t seem to expect a
volatile variable (which I need to expose).
I also read somewhere that
Spark.publish shouldn’t be used inside an interrupt (haven’t verified).
So, when are interrupts appropriate?