I'm building a small project using NodeMCU (ESP8266). I want to scan all available WiFi networks collect them in array. Here is my function:
String getWifiArray(void){
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(500);
byte n = WiFi.scanNetworks();
String nets[] = {};
for (byte i=0; i<n; i++){
nets[i]= WiFi.SSID(i);
}
return nets[];
}
I get expected primary-expression before ']' token
error.
How could I fix this code?