Sorry, if you took my post as scrutinizing yours - it wasn’t meant that way - and "yes!" the example would need looking at too, but I think my point is valid for the a button (which usually means floating pin when not pressed), while the example does not explicitly talk about a button.
I’d rather gather from the use of
CHANGE that there is a interrupt source in use that does effectivly provide two defined states for HIGH and LOW, which a button does (usually) not.
(But on second read I’ve seen that the OP uses a sensor rather than a button)
As for the pin selection, the example dates back to the Particle Core where such limitations did not exist (but others) and I didn’t say you can’t use these pins, but where possible avoid them.
And despite the fact that my post was marked as reply to you ( @BulldogLowell ), I presset the “Reply” button for the thread and actually wanted to provide helping pointers for the OP and definetly not get a you.
Sorry if you misunderstood me that way!