**FIXED** Correct way to put an Argon to sleep and wake it back up

I’m trying to follow along with the various threads about the Argon and sleep, but don’t seem to have code that does it just yet. This was easier in Sleep 1.0 on the Photon, but I need the Argon as I’m going to replace it with LTE eventually, and want to use the same PCBA I’m designing.

Anyway, why doesn’t this code wake the Argon up correctly? I see D7 turn on, and the RGB just breathes blue like it’s listening, not connecting. D7 never turns off, nor does it ever connect to the cloud. The first boot works fine, it connects to MQTT and sends my temp probe data to my server just fine. The goal is to do this every 15 minutes (it’s 1 minute for testing right now) on a battery and solar setup from Sparkfun. That part works, but I can’t get it to wake up and reconnect.

void goToSleep()

bool wakeup()


    if (!Particle.connected())

    return connectMQTT();

void setup() 
    Log.info("App getting started");

    pinMode(D7, OUTPUT);

    if (!connectMQTT()) {
        Log.error("Could not connect to the MQTT sources");
    else {
        Log.info("Connected to services");

    Log.error("Firmware Version: %d", APP_ID);

void loop() 
    SleepResult result = System.sleepResult();
    if (result.wokenUpByRtc()) {
        digitalWrite(D7, HIGH);
        digitalWrite(D7, LOW);

    for (int i = 0; i < MAX_RETRIES; i++) {
        if (readEnvironment())


Testing to see if my autocomplete bug of WiFi.connecting instead of connect is at fault.

Yes, that was it.

@peteb did that fix your issue then?

Yes, I spent a day and a half trying to figure out what was going on. Copying/pasting into this message made me see it. VSCode kept changing connect to connecting every time I typed it out as I was testing. I never noticed.

Note to those who need it, VSCode is very bad at guessing what you want via autocomplete. And even if you try to type the entire word out and hit enter, it will replace it with a different value sometimes.

@peteb, you can disabled Intellisense autocomplete features to avoid this problem. Look here:

Thanks, I actually kind of like it. But it does have drawbacks. I tend to use it for identifying available API’s for a given class and using it to figure out if I’m using the class wrong. But I keep forgetting that it tends to do what I did above.

It’s a give/take kind of thing.

Thanks, @peteb! Your solution saved me a ton of time.