Connecting to a Router
-
I am trying the sample code:
from network import WLAN import machine wlan = WLAN(mode=WLAN.STA) wlan.connect(ssid='My_SSID', auth=(WLAN,WPA2, '**********')) while not wlan.isconnected(): machine.idle() print("WiFi connected succesfully") print(wlan.ifconfig())
but I get this:
>>> Traceback (most recent call last): File "<stdin>", line 6, in <module> NameError: name 'WPA2' isn't defined > Pycom MicroPython 1.20.2.rc3 [v1.11-2037465] on 2020-02-05; LoPy4 with ESP32 Pybytes Version: 1.3.1 Type "help()" for more information. >>> >>>
What does it mean?
I´m sure I put the correctly WiFi credentials.
-
@jcaron you are right, thanks.
-
@Erick-Falcon you have a typo. It should be
WLAN.WPA2
(with a dot), notWLAN,WPA2
(with a comma).
-
@Erick-Falcon May be refer [WLAN}(https://docs.pycom.io/tutorials/all/wlan/) to connect?