How can I turn on LED on wake from sleep()?

I’ve got a dead simple toy I’ve built with my Electron. Literally it’s a button press that sends an email. I’m doing everything I can to save battery consumption so I’m putting my Electron to sleep with the following:

System.sleep(WKP,RISING);

I’ve got a perma proto all soldered up and installed in custom chassis I’ve printed. It’s working wonderfully. Flawlessly, even. :grinning:

My build is missing a feature though - a light to let the user know their input has been received. The chassis its in is solid black, so the on-board LED is not visible. And since (as far as I know) the Electron has to run through the wake-up process and get itself all comfortable before it executes any code, there’s like a 15-second delay between the button press and the activation of an LED. Which is basically the same as having no LED at all.

So how can I:

  • Maintain battery conservation
  • Turn on an LED during boot, OR
  • output the on-board LED’s activity to an external LED wired to the board?

Any ideas? I’ve put this in the “firmware” category in case somebody can think of something I can do in the firmware to turn an LED on. If it’s miscategorized, apologies in advance.

Have a look at system modes and/or system threads. There should also be a ‘startup’ function, though I’m not quite sure on that one. I believe the docs also have an example on how to copy the onboard LED to an external one, if you want the ‘full’ status.

1 Like

Beauty, thanks for taking the time. I’ll have a look for that example code for sure, that’d work perfectly for me.

Cheers!