WiFi connect and HTTP
Join a network, log the link events, and poll an endpoint every five seconds — Request carries the whole HTTP call.
Click through the files — it's the whole project
WiFi connect and HTTP — Visual Studio Code
Select a file from the explorer
esp32s3_devkitc · HTTP WiFi · Request · events
What's going on
- The
WiFiconstructor carries the whole link policy — credentials, a 15 s associate timeout, power saving.join()blocks until there's an IP;onUp/onDropfire on the link's own schedule after that. - Each poll is one
Requestobject: method, URL, headers, send, thenok()/text(). The body is valid until the nextsend()— copy it out if you need to keep it. https://is native — pass acaCertto verify, orinsecure: truefor a lab server you don't trust to have a real certificate.- WiFi needs an ESP32 target —
esp32s3_devkitchere. One hardware note worth knowing: some ESP32-S3 dev kits reboot the moment the radio transmits. If the board restarts onjoin(), it's usually power, not code.
Flash and watch
terminal
npx @typecad/hal create my-project --target esp32s3_devkitc
cd my-project
npx @typecad/hal build --compile --upload --port COM4Put your own SSID and PSK in src/main.ts before flashing. Then open a serial
monitor at 115200 — you'll see the IP on join, and a health line every five seconds. Point
the URL at anything on your LAN that answers GET.
Where to go next
- Networking — static IPs, scanning, async joins, and the full Request options
- MQTT — the next step up from polling
- Boards — target names and what compiles where