I've tried multiple versions of MicroPython, and I've tried multiple APs.
I've also tried CircutPython and using the Arduino IDE directly.
Reading this bug report ( https://github.com/espressif/arduino-esp32/issues/6430 ), it noted some people had some success with changing the transmit power, but that's not working for me either.
This bug report ( https://github.com/orgs/micropython/discussions/10524 ) is purely MicroPython based, which is also relevant to the errors I'm seeing in MicroPython.
CircutPython just bombs with "ConnectionError: Unknown failure 2"
Just about every suggestion in these issues I've tried in one way or another.
I'm pretty stuck at the moment. Any input would be appreciated.
Basic code as follows:
Arduino:
Code: Select all
void setup()
{
Serial.begin(115200);
while(!Serial){delay(100);}
// We start by connecting to a WiFi network
Serial.println();
Serial.println("******************************************************");
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
WiFi.setTxPower(WIFI_POWER_8_5dBm);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
Code: Select all
import time
import network
import urequests
station = network.WLAN(network.STA_IF)
station.active(True)
# Network settings
wifi_ssid = "MY_SSID"
wifi_password = "MY_PASSWORD"
url = "http://wifitest.adafruit.com/testwifi/index.html"
print("Scanning for WiFi networks, please wait...")
authmodes = ['Open', 'WEP', 'WPA-PSK' 'WPA2-PSK4', 'WPA/WPA2-PSK']
for (ssid, bssid, channel, RSSI, authmode, hidden) in station.scan():
print("* {:s}".format(ssid))
print(" - Channel: {}".format(channel))
print(" - RSSI: {}".format(RSSI))
print(" - BSSID: {:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}".format(*bssid))
print()
# Continually try to connect to WiFi access point
while not station.isconnected():
# Try to connect to WiFi access point
print("Connecting...")
station.connect(wifi_ssid, wifi_password)
time.sleep(10)
# Display connection details
print("Connected!")
print("My IP Address:", station.ifconfig()[0])
Code: Select all
import os
import ipaddress
import wifi
import socketpool
print()
print("Connecting to WiFi")
# connect to your SSID
wifi.radio.connect(os.getenv('CIRCUITPY_WIFI_SSID'), os.getenv('CIRCUITPY_WIFI_PASSWORD'))
print("Connected to WiFi")
pool = socketpool.SocketPool(wifi.radio)
# prints MAC address to REPL
print("My MAC addr:", [hex(i) for i in wifi.radio.mac_address])
# prints IP address to REPL
print("My IP address is", wifi.radio.ipv4_address)
# pings Google
ipv4 = ipaddress.ip_address("8.8.4.4")
print("Ping google.com: %f ms" % (wifi.radio.ping(ipv4)*1000))