[Digi-Key Follow me Issue 2] + Network function usage based on CircuitPython
[Copy link]
Task 2: Network Function Usage
Rendering
Note: The IP address shown at the top of the above picture is the IP address assigned to the WIFI. The two lines printed at the bottom are the created hotspot, WIFI name and WIFI password, which can be searched by the mobile phone.
Main code snippets and descriptions corresponding to task functions
The first step is to create a hotspot, which is also very simple. Import the wifi library
Then call the start_ap function and fill in your hotspot name and password.
You can also print the created name, password and IP add to the screen. Here I only display the name and password. The following is the full code
import os
import time
import ssl
import wifi
import socketpool
import microcontroller
import adafruit_requests
wifi.radio.start_ap("adafruit_wifi", "12345678")
print(f"NtworkName: adafruit_wifi")
print(f"Password: 12345678")
while True:
pass
Connect to WIFI and configure the following file
This is the source code
|