System.on(reset) not working

Hey guys, I’m trying the example from the documentation and I can’t get it to work. I don’t see the handler published event in the dashboard.

Am I missing something here? Thanks!

void reset_handler()
 {
     // turn off the crankenspitzen
     digitalWrite(D6, LOW);
     // tell the world what we are doing
     Particle.publish("reset", "going down for reboot NOW!");
 }

 void setup()
 {
     // register the reset handler
     System.on(reset, reset_handler);
 }

 void loop() {
	 Particle.publish("enter loop", "about to call reset");
	 delay(2000);
	 System.reset();
 }

All I get in the dashboard is this:

There is not enough time to finish the publish before the device resets.
You’d need to give it a few seconds of Particle.process() to finish off, but I’m not sure if hanging in the handler that long is safe.
Try some shorter action (D7 blink, Serial.println()) to give you feedback whether the handler fired or not.

1 Like