2017-04-19 149 views
0

如何使用MicroPython獲得連接到我的NodeMCU設備的WiFi的WLAN設備的RSSI值?其實我嘗試了下面的代碼,但我得到一個錯誤:在NodeMCU中使用MicroPython的RSSI值ESP8266

>>> sta_if.ifconfig()   
('192.168.1.103', '255.255.255.0', '192.168.1.1', '192.168.1.1') 

>>> sta_if.rssi()   
Traceback (most recent call last):   
    File "<stdin>", line 1, in <module>   
AttributeError: 'WLAN' object has no attribute 'rssi' 

我不知道我該怎麼做才能獲得網絡的RSSI值。

回答

1

WLAN class documentation

wlan.scan()

Scan for the available wireless networks.

Scanning is only possible on STA interface. Returns list of tuples with the information about WiFi access points:

(ssid, bssid, channel, RSSI, authmode, hidden)