Hi!
I want to scan for nearby WiFi networks and send the list through a serial connection to an Uno while being outside the range of my own network. I'm using a Photon. For some reason my program only works in the automatic system mode connected to the cloud, and thus not outside. Whenever the scan starts the status LED is white for a moment and then sends an SOS followed by one blink, indicating a hard fault of some kind. What am I doing wrong? Should I be calling Particle.process() somewhere?
SOLUTION: put WiFi.on() in setup loop
code:
SYSTEM_MODE(SEMI_AUTOMATIC);
void setup() {
// USB serial
Serial.begin(9600);
while(!Serial){}
Serial.println("Hello world.");}
void loop() {
// Scan for acces points
WiFiAccessPoint aps[20];
int found = WiFi.scan(aps, 20);
for (int i=0; i<found; i++) { WiFiAccessPoint& ap = aps[i]; Serial.print(String(i+1) + ": "); Serial.print(ap.ssid); Serial.print(" ["); Serial.printf("%02X:%02X:%02X:%02X:%02X:%02X", ap.bssid[0], ap.bssid[1], ap.bssid[2], ap.bssid[3], ap.bssid[4], ap.bssid[5]); Serial.print("] ("); Serial.println(String(ap.rssi) + ")"); }
}