linux-downey / w600_development_board_document

9 stars 1 forks source link

WiFi Scan Example #5

Open spacehuhn opened 5 years ago

spacehuhn commented 5 years ago

Not an issue, but I can't make a proper pull request either (because the entire repo contains only of a single zip file at the moment).

So here's my access point scanner example:

#include "W600WiFi.h"
#include "W600WiFiScan.h"

void setup() {
  Serial.begin(115200);
}

void loop() {
  Serial.print("Scanning...");

  WiFi.scanNetworks();

  int n;

  do {
    delay(100);
    n = WiFi.scanComplete();
  } while(n < 0);

  Serial.print("Done ");
  Serial.println(n);

  Serial.println("ID CH RSSI    BSSID             SSID"); 

  for (int i = 0; i < n; i++) {
    printf("%-2d %-2d %-4ddBm %s %-32s\n", i, WiFi.channel(i), WiFi.RSSI(i), WiFi.BSSIDstr(i), WiFi.SSID(i)); 
  }
  Serial.println("-----------------------");

  delay(10000);
}

The scan only works asynchronously right now. Someone might want to fix the W600WiFiScan.cpp to make it work properly.