Blink external led while connecting

  1. Is there a way to flash an external led (connected to a GPIO pin) while the Spark Core is booting/connecting to the cloud? When users power on my device with the on/off switch, I want to start blinking a light so they know something is happening. They will not be able to see the led on the core. I currently have the led turn green in the loop(), but it only lights after the core is connected.

  2. If that led is RGB can I mimic the onboard led with the full range of signals?

Hi @pkucera,

Sure thing! You might need to do some firmware hacking, but If you wanted to mirror the RGB led to another one, you could just copy the signals to your own device. You’ll find references in core-firmware and core-common-lib for:



1 Like

Thanks @Dave. Those core files are going to be quite useful.

Unfortunately, I do not see how to have anything in my loop() or setup() run until AFTER the Core completes it’s full WLAN initialization. If I need an indicator light to come on immediately when the power switch is turned on to so the users see that something is happening, can I do that in my firmware sketch or does it require customization to the cores firmware?

Maybe I just need to better understand the boot sequence and where my sketch fits into that sequence.


In the current implementation, you’ll need to modify the firmware to have your bit of code run first. The boot sequence looks something like this (very crude):

  1. Initialize the clock
  2. Initialize the hardware
  3. Set up the WiFi
  4. Run the setup() once
  5. Run the user loop()
  6. Run the WiFi loop
  7. Goto user loop()

You can add your bit of code to run before the main.cpp enters the while(1) loop. Or if you know what you are doing you can also modify the SPARK_WLAN_Loop();

I wonder if we shouldn’t add a pre-setup hook?


A hook would be nice so that the device could continue to get firmware updates without having to worry about overwriting any changes that I made. The hook would allow me to start sending signals to the led (or call some pre-init function) as soon as the device is powered. I imaginge that my loop() could then check for the initialization procees to be complete (some spark_wlan isRunning() boolean) to indicate all system are running.

1 Like