Run code on blinkup or clear


#1

Is it possible to attach a handler to a blinkup on the device? Right now, I care most about being able to recognize a clear-settings event. We store some connection authentication information on the imps and would like to have a user-accessible way to clear it out if we have to.


#2

You can figure out why the imp woke up with hardware.wakereason()
https://electricimp.com/docs/api/hardware/wakereason/
Value 9 is WAKEREASON_BLINKUP, which will probably do what you want :slight_smile:


#3

Good idea! Thanks.