This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import board | |
| import busio | |
| import sys | |
| import os | |
| from digitalio import DigitalInOut | |
| import ipaddress | |
| import wifi | |
| import socketpool | |
| import ssl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if 'ESP32S2' in os.uname().machine: | |
| print("MAC", ":".join('%x' % x for x in wifi.radio.mac_address)) | |
| # don't proceed w/o any Wi-Fi APs | |
| print("Scanning WiFi...") | |
| while True: | |
| try: | |
| for network in wifi.radio.start_scanning_networks(): | |
| print("{0:02X}:{1:02X}:{2:02X}:{3:02X}:{4:02X}:{5:02X}".format(*network.bssid), | |
| network.channel, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import wifi | |
| import socketpool | |
| import struct | |
| import time | |
| import sys | |
| from secrets import secrets | |
| NTP_TO_UNIX_EPOCH = 2208988800 # 1970-01-01 00:00:00 | |
| packet = bytearray(48) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # server code: | |
| # https://github.com/adafruit/circuitpython/blob/main/tests/circuitpython-manual/socketpool/client/host-server.py | |
| import board | |
| from digitalio import DigitalInOut | |
| from adafruit_esp32spi import adafruit_esp32spi | |
| import adafruit_esp32spi.adafruit_esp32spi_socket as socket | |
| import adafruit_requests as requests | |
| from secrets import secrets |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Socket Feature Availability | |
| CircuitPython CircuitPython | |
| CPython ESP32SPI ESP32-S2 | |
| TCP Server Yes Not Impl. Yes | |
| TCP Client Yes Yes Yes | |
| UDP Server Yes Not Impl. Yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import board | |
| import displayio | |
| import terminalio | |
| display = board.DISPLAY # or equivalent external display library | |
| splash = displayio.Group() | |
| fontx, fonty = terminalio.FONT.get_bounding_box() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import struct | |
| import board | |
| import busio | |
| import microcontroller | |
| import supervisor | |
| import os | |
| import gc | |
| import time | |
| import random | |
| import rtc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import gc | |
| import time | |
| import board | |
| import digitalio | |
| import supervisor | |
| import ipaddress | |
| import wifi | |
| import socketpool | |
| import ssl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import gc | |
| import time | |
| import board | |
| import digitalio | |
| import supervisor | |
| import random | |
| import wifi | |
| import espidf | |
| import ipaddress |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import board | |
| from digitalio import DigitalInOut, Direction | |
| from adafruit_wiznet5k.adafruit_wiznet5k import WIZNET5K | |
| import adafruit_wiznet5k.adafruit_wiznet5k_socket as wiznet5k_socket | |
| from adafruit_esp32spi import adafruit_esp32spi | |
| import adafruit_esp32spi.adafruit_esp32spi_socket as esp_socket | |
| import wifi | |
| import socketpool | |
| import ssl | |
| import adafruit_requests |