I am developing an application where Photon is used as a slave microcontroller. Right now I am programing it from the Desktop IDE, flashing from cloud. However for the final application, the wifi must be off by default in Photon, only activated when a serial port message from the Master microcontroller is received.
Do you know any example or tutorial where I can learn how to use properly the functions related with the WIFI?
Thanks in advance.
There’s always the documentation to go by. Give that a shot, and try asking some more concrete questions. Manual mode might be something you want to look into.
// SYSTEM_MODE(AUTOMATIC); // un-comment this for OTA development
// SYSTEM_MODE(MANUAL); // un-comment this for final release to disable Wi-Fi
Should I need to get it back to Automatic i add this to loop()
// Did the user at the Terminal want to do something ?
char key = Serial.read();
if(key == '0')
Serial.printf("Turning WiFI Off\r\n");
else if(key == '1')
Serial.printf("Turning WiFI On\r\n");
Hi Moors7 and seulater,
Thanks for the prompt and kind replies. After checking the modes I can see that for the final release I will need to go in SYSTEM_MODE (MANUAL). A couple of questions about that?
When Photon starts in Manual mode, I can read that the cloud connection is disabled but is it already the wifi OFF? or the first thing I have to in the setup is Wifi_off();? I want to be sure that the wifi chip is really off, because of EMI measurements and consumption.
Suppose I have the photon coded with the final release (wifi_off). Then I want to do an update of the code and I would like to use the desktop IDE for flashing from cloud. Is a factory reset the fastest way to come back to automatic mode? Do you think in a better way?
MANUAL mode the radio module is off by default.
What @seulater’s code does not show is that you need to you need to take care of the connection after
Particle.connect() via regularly (as often as possible) calling
If you don’t want that extra hassle, you can also go with
SEMI_AUTOMATIC mode which will start off like
MANUAL but once connected the system takes care of the house keeping.
Your second question is a bit open. If you only want on-demand cloud connection (e.g. for flashing) you can initiate a cloud connection in your code (e.g. via a button).
If you don’t want anything in your code to do that, there is always Safe Mode.
And finally, on Photon’s there is no inbuilt factory reset. You’d need to flash some firmware that reverts back to