Hi there,
Ok, so I can compile it as an Mbed 2.9.0 & 2.9.2 No errors.
Serial output and taping GND pin with jumper from pin2. It stops but doesn’t sleep, same with removing the PIN2 > GND connection. So it is registering the interrupt.
Interrupt Counter: 22
Interrupt Counter TEST: 22
Interrupt received!
Going to System OFF
Interrupt Counter: 0
Interrupt Counter TEST: 0
Interrupt Counter: 0
Interrupt Counter TEST: 0
Interrupt Counter: 0
Interrupt Counter TEST: 0
Interrupt Counter: 0
Interrupt Counter TEST: 0
Interrupt Counter: 4
Interrupt Counter TEST: 4
Interrupt received!
Going to System OFF
Interrupt Counter: 0
Interrupt Counter TEST: 0
I would take a look at the demo I posted a while back and see if your logic is correct. I use the button to sleep and to wake.
HTH
GL PJ