All of the tutorials show using System.on(button_click, handler)
to get notified when the mode/setup button is pressed. I can't seem to get this to work on my Photon 2. When I press the button the light changes to show the RSSI, but no event is fired. I also logged all events to see if I had the wrong event, but none of 128, 4096, 8192 are fired. Single press, triple press (double press goes to sleep), long press, etc, nothing. Am I missing something?
#include "Particle.h"
SerialLogHandler logHandler(LOG_LEVEL_WARN);
void event_handler(system_event_t event, int param) {
Log.warn("got event %d with value %d", (int)event, param);
}
void setup() {
Serial.begin();
System.on(all_events, event_handler);
}