In order, the example code...
Checks the ESP32's MAC address.
print("My MAC addr:", [hex(i) for i in wifi.radio.mac_address])
Performs a scan of all access points and prints out the access point's name (SSID),
signal strength (RSSI), and channel.
print("Avaliable WiFi networks:")
for network in wifi.radio.start_scanning_networks():
print("\t%s\t\tRSSI: %d\tChannel: %d" % (str(network.ssid, "utf-8"),
network.rssi, network.channel))
wifi.radio.stop_scanning_networks()
Connects to the access point you defined in the secrets.py file, prints out its local IP
address, and attempts to ping google.com to check its network connectivity.
print("Connecting to %s"%secrets["ssid"])
wifi.radio.connect(secrets["ssid"], secrets["password"])
print(print("Connected to %s!"%secrets["ssid"]))
print("My IP address is", wifi.radio.ipv4_address)
ipv4 = ipaddress.ip_address("8.8.4.4")
print("Ping google.com: %f ms" % wifi.radio.ping(ipv4))
©Adafruit Industries Page 146 of 263