fork(1) download
  1. /*
  2.  * This sketch demonstrates how to scan WiFi networks.
  3.  * The API is almost the same as with the WiFi Shield library,
  4.  * the most obvious difference being the different file you need to include:
  5.  */
  6. #include "WiFi.h"
  7.  
  8. void setup()
  9. {
  10. Serial.begin(115200);
  11.  
  12. // Set WiFi to station mode and disconnect from an AP if it was previously connected
  13. WiFi.mode(WIFI_STA);
  14. WiFi.disconnect();
  15. delay(100);
  16.  
  17. Serial.println("Setup done");
  18. }
  19.  
  20. void loop()
  21. {
  22. Serial.println("scan start");
  23.  
  24. // WiFi.scanNetworks will return the number of networks found
  25. int n = WiFi.scanNetworks();
  26. Serial.println("scan done");
  27. if (n == 0) {
  28. Serial.println("no networks found");
  29. } else {
  30. Serial.print(n);
  31. Serial.println(" networks found");
  32. for (int i = 0; i < n; ++i) {
  33. // Print SSID and RSSI for each network found
  34. Serial.print(i + 1);
  35. Serial.print(": ");
  36. Serial.print(WiFi.SSID(i));
  37. Serial.print(" (");
  38. Serial.print(WiFi.RSSI(i));
  39. Serial.print(")");
  40. Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
  41. delay(10);
  42. }
  43. }
  44. Serial.println("");
  45.  
  46. // Wait a bit before scanning again
  47. delay(5000);
  48. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:6:18: fatal error: WiFi.h: No such file or directory
 #include "WiFi.h"
                  ^
compilation terminated.
stdout
Standard output is empty