Can you try adding
self in
def do_connect(self):?
I've made the following test in
repl.
Code: Select all
MicroPython v1.12 on 2019-12-20; ESP32 module with ESP32
Type "help()" for more information.
>>>
paste mode; Ctrl-C to cancel, Ctrl-D to finish
=== import network
===
=== class WIFI:
=== def do_connect(self):
=== station = network.WLAN(network.STA_IF)
=== station.active(True)
=== if not station.isconnected():
=== print('connecting to network...')
=== station.connect('Niron', 'projects1234')
=== while not station.isconnected():
=== pass
=== print('network config:', station.ifconfig())
>>> c = WIFI()
>>> c.do_connect()
I (16280) wifi: wifi driver task: 3ffe2f38, prio:23, stack:3584, core=0
I (32778) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (32788) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (32818) wifi: wifi firmware version: aeed694
I (32818) wifi: config NVS flash: enabled
I (32818) wifi: config nano formating: disabled
I (32818) wifi: Init dynamic tx buffer num: 32
I (32828) wifi: Init data frame dynamic rx buffer num: 32
I (32828) wifi: Init management frame dynamic rx buffer num: 32
I (32838) wifi: Init management short buffer num: 32
I (32838) wifi: Init static rx buffer size: 1600
I (32848) wifi: Init static rx buffer num: 10
I (32848) wifi: Init dynamic rx buffer num: 32
I (32948) phy: phy_version: 4102, 2fa7a43, Jul 15 2019, 13:06:06, 0, 0
I (32948) wifi: mode : sta (24:6f:28:17:ee:3c)
I (32948) wifi: STA_START
connecting to network...
I (35008) wifi: STA_DISCONNECTED, reason:201
no AP found
I (37058) wifi: STA_DISCONNECTED, reason:201
no AP found