buttonMirror() soft power down

I am using an ELECTRON and controlling it remotely with Blynk. I want to be able to perform a soft power down of the ELECTRON using a virtual button widget in Blynk. It would appear from reading the docs that buttonMirror() might be the way to do this. Has anyone tried using a button widget assigned to a virtual pin (in Blynk) to perform a soft power down?

Thanks in advance

After reading what buttonMirror does, I don’t think that’s what you are after. The buttonMirror allows you to mirror the MODE button to another physical pin on the Electron. Looks like you want to power down the Electron via a virtual button on Blynk. If you can create a button on Blynk to activate a GPIO, then I’m sure you can also do some sort of sleep with it as well. You first have to figure out which Electron sleep mode best fits the behavior you desire. You may want to also digest this guide on selecting sleep modes:

After you determine that, you would do something like this pseudo code:

bool doSleep = false;

void BlynkCallBack() {
    doSleep = true;
}

void loop() {
    if (doSleep) {
        //activate the chosen sleep mode here.

        doSleep = false;  //Reset the sleep flag.
    }
}

One issue you might have is waking the Electron back up. Not sure if you can do that remotely via Blynk. You can use the physical WKP pin to wake it up if you are nearby the device.

1 Like

I think the soft-power-down is the same as System.sleep(SLEEP_MODE_SOFTPOWEROFF, seconds);

1 Like

@ninjatill Thanks very much for your reply and the detailed information you provided. You are correct in that I want to be able to power down the Electron via a virtual Blynk button widget. Creating the virtual pin to control the GPIO is something that I have done before, so that is where I will start.

@ScruffR Thanks for the information you have provided as well.

WKP will be accomplished via a physical button push as you have suggested.

Thank you both again for pointing me in the right direction

1 Like

If you use Network_Standby Sleep mode, you'll be able to also wake the Electron from the Cloud.
Of course, this will draw more current than SoftPowerOff.
I'm not sure if this is a viable option for your project, but it's a cool feature !

1 Like

@Rftop Thanks very much for another very interesting solution!