Having issues storing volatile pin variable in singleton with method attached to CHANGE interrupt

Despite the name, your class is not a singleton. There are two different instances of it: the static variable instance in the getInstance() function, and the global variable SomeInstance.

See Interrupt in class, ESP32 - #44 by PieterP for a example of using interrupts with classes.

Unless you plan on changing the pin number after attaching the interrupt, it should not be volatile.

1 Like