Ah yeah, sorry about that.
The code I have, which I use on the UNO, is:
int SILENT_BUTTON_PIN = 3; // Interrupt pin on UNO so…
int SILENT_BOTTON_INTERRUPT = 1; // Pin 3 = Interrupt 1. If using Pin 2, then Interrupt is 0.
So, I use pin D2 as the pin my button is connected to. On the UNO, Pin D2 and D3 can be used as interrupts. If using D2, then the interrupt would be 0. And on D3, the interrupt is 1. (You only have 2 interrupt pins).
So when I attach the interrup in my setup(), I use:
attachInterrupt(SILENT_BOTTON_INTERRUPT, handleButtonStateISR, RISING); // Attach an Interrup to the button press pin.
That calls my method, handleButtonStateISR(), which simply toggles a LED on and off.
attachInterrupt([Interrupt number], [MethodToExecute], [StateChange - RISING, FALLING or CHANGE]);
What I am trying to find is which pins on the Particle Photon I can use, an what their Interrupt number would be.
On the UNO, it’s:
D2 = Interrupt 0
D3 = Interrupt 1
What I am trying, on the Photon is assigning the same Pin number as the Interrupt:
int SILENT_BUTTON_PIN = 4;
int SILENT_BOTTON_INTERRUPT = SILENT_BUTTON_PIN;
attachInterrupt(SILENT_BOTTON_INTERRUPT, handleButtonStateISR, RISING);
Oh my God, that worked!!
I had the attachInterrupt line commented out!
Is this the right way to do it? Basically, on the Photon, all pins can be used as Interrupts, and … you just assign the pin number to the attach call?