How to force connect to wifi

before I soldered my project, I had my photon powered via USB where I would read A0 send it to the cloud and goto sleep for 60sec.

I added this button so when it’s press, you stay connected to wifi in loop so I could reflash it.
That is a patch so it does not go into sleep mode and lose my wifi and can’t program it.

well that button was working fine and for some reason it does not anymore. I am stuck and can’t flash it anymore! :see_no_evil:The particle still send data every 1min and goes to sleep. That works but I can’t reflash it. It’s not connected long enough to wifi for me to flash it.

I change the code to use external antenna but I need recommendation to actually flash my new code.
I also change the button routine to make it more robust.

My assembly is all done and USB is not accessible. But I guest I will have to take it apart.

What do I do?
doctor mode?
yellow light and flash it?

> # how to compile and flash a directory of source code to your device
> $ particle flash 0123456789ABCDEFGHI my_project

https://docs.particle.io/reference/developer-tools/cli/#particle-flash

I tried all of them and don’t know how to do it, seems that I need the files (.bin) on my computer.
it can’t find my fille .ino

tried flashing tinker but it’s offline so that yellow light is not good for that.
even if I hold setup for 3 sec, I start the wifi process over but once connected to wifi it goes back to sleep again…

:rofl:

You can always use Safe Mode tho'

Other than that, we cannot advise more without knowing more about your code and your button check.

yes! Safemode!

Safe mode allows network connectivity but does not run your user firmware. This is most useful when you want to OTA (over-the-air) cloud flash code to your device but:

  • You have a program that runs with the cloud connection turned off
  • Your program uses sleep mode to save power
  • You have a bug in your code that prevents cloud access (breathing green)

here is the code, the proper way of doing this would be to attach the button on WAKE pin and generate interrupt to wake entire photon and go into manual wifi connection and stay connected.

now, I press reset on device and press the button to enable this feature.

void loop() 
{ 
    
    if( digitalRead(button) == LOW){    // enter here only when human need to flash the module
  
       digitalWrite(LED,HIGH);      // when you see the blue LED light up, remove finger ASAP
       delay(1000);                 // this is patch so you have time to remove finger
      
       do{
            // this loop is actually so you can connect to wifi and program the device
            digitalWrite(LED, !digitalRead(LED));  
            delay(200);                      
       
        } while(digitalRead(button) == HIGH);     //will wait until you press button to go our of the loop. if you do == LOW, then it wait until you remove finger from button, this mean you need to always have finger on button while you program

      digitalWrite(LED,LOW);
      gotoSleep();                            // you can go to sleep now or just comment this out and let the rest of the code do it's thing.
        
        
    }else{  // you always come here after you wake up

        int value=analogRead(A0); 
        
        if( mqtt.Update() ){ 
            voltage.publish(value); 
        }   
        
        gotoSleep();
    
    }

} // end main loop

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.