I am passing WiFi credentials to P1 over UART. When the credentials are sent P1 tries to connect to WiFi using those credentials and if the credentials are wrong, P1 should wait till the credentials are sent from UART again. But this is not happening at present.
Instead, the P1 RGB LED blinks blue if the credentials are wrong. When I open Serial console and type something, it says waiting for binary file to be sent … press a to abort. I think P1 entered listening mode where it is expecting credentials over USB. I want to define my custom listening mode. How do I do this?
I am sending wifi credentials over Serial. If I enter the right credentials, it should connect and be connected. If that wifi hotspot is turned off, it should wait for credentials over serial. With the mentioned code, my loop() works in parallel with soft AP. Also after some time, the particle closes it’s Serial. (I think my P1 is restarting).
I am testing the reliability of WiFi. I am using my phone hotspot as an access point. It is available and not hidden. When the hostpot is on P1 connects to it. When it is off I want P1 to switch to a new WiFi hotspot if the credentials sent over UART are success or if the old WiFi hotspot is back, it should reconnect to that hotspot.
Is it possible to wait for Serial data as well as keep the loop() running?