Hello,
I have been trying to connect my ESP8266 to my local networks.
I assumed that in the end I succeeded, but something's wrong in here.
I read the documentation: https://docs.micropython.org/en/latest/ ... networking
Code: Select all
import network
from network_config import SSID, PASSWD
Code: Select all
nic = network.WLAN(network.STA_IF) #Creating network interface card object
nic.active(True)
nic.connect(SSID, PASSWD)
print(nic.scan() )
print(nic.isconnected())
print(nic.active)
print(nic.status)
print(SSID,"\n", PASSWD)
it's then set to active, then it should connect to the network.
It turns out that both .active() and .status() return <bound_method> (what is this?)
and .connect() method gives me "NONE"??
Ignoring these weird values, the code later is as the following:
Code: Select all
if nic.isconnected():
print("Connected to", SSID)
oled.fill(0)
oled.text('Connected to:', 0, 24, 1)
oled.text('SSID', 32, 48, 1)
oled.show()
sleep(2)
else:
nic = network.WLAN(network.AP_IF)
nic.active(True)
print("FAIL, falling to AP mode")
...
the isconnected() returns FALSE.
Why?
The device appears in my router's management website.
The name is "ESP_1123AC", however it seems to be a wrong name?
I also have it in my WiFi networks, as if it was simultaneously in AP and STA mode, it isn't possible.
I thought that perhaps Thonny was letting me upload code to devices this way (my PC is using WiFi card), but I am not sure in the end.
Am I doing something wrong in here?
I could have missed something.
PS:
I really like MicroPython and want to make use of it in my mini greenhouse project and similar ones.
It seems to work incredibly on ESP chips. It's heaven and earth compared to random scattered libraries from Arduino etc.
The filesystem is absolutely great, a very useful feature.
I have been programming 3D Printers with marlin and MicroPython is awesome.
Please continue supporting it:P