-->
Page 1 of 2

Wifi Scan

PostPosted: Sun Aug 07, 2016 12:51 pm
by Luc Volders
Hi there,

I have a question which may not easily be solved but here we go.

One of the first test programs for any ESP is the wifi-scan program:

Code: Select all   
-- print ap list
    function listap(t)
          for ssid,v in pairs(t) do
            authmode, rssi, bssid, channel =
              string.match(v, "(%d),(-?%d+),(%x%x:%x%x:%x%x:%x%x:%x%x:%x%x),(%d+)")
            print(ssid,authmode,rssi,bssid,channel)
          end
    end
         
    wifi.sta.getap(listap)


This Lua code not only shows the name of the Access Point but also the MAC adress.

Now I know there is an equivalent in Arduino code however that does not display the MAC adress.

Anybody has a solution for this, as I really could use this for a project.

Luc

Re: Wifi Scan

PostPosted: Sun Aug 07, 2016 1:51 pm
by mrburnette
One can do a site-specific Google search:
Code: Select allArduino ESP8266 MAC site:esp8266.com



http://www.esp8266.com/viewtopic.php?f=29&t=3587

Re: Wifi Scan

PostPosted: Mon Aug 08, 2016 2:21 pm
by Luc Volders
I did the search and gotten no results.

Why is it incorporated in Lua and not in Arduino ???

In Lua it is easy. Just do a wifi scan and you get all AP's names and MAC adresses.
That's what I need.

Luc

Re: Wifi Scan

PostPosted: Mon Aug 08, 2016 3:31 pm
by martinayotte
It is existing in Arduino :

Code: Select all    int n = WiFi.scanNetworks();
    for (int i = 0; i < n; i++) {
      Serial.print(WiFi.SSID(i));
      Serial.print(" / ");
      Serial.print(WiFi.RSSI(i));
      Serial.print(" / ");
      Serial.println(WiFi.BSSIDstr(i));
    }