Network
Your "Passport to the Internet"
Connecting the D1 R32 to Wi-Fi and Communicating over Networks
What it is
The Network category contains blocks for connecting the D1 R32 to Wi-Fi and performing more advanced network communication.
The category covers four main areas:
- Wi-Fi connection
- Access Point configuration
- TCP / UDP socket communication
- Network time
Think of Network as two levels: first CONNECT the D1 R32 to a network, then COMMUNICATE through that network.
Fun Guide to Network Blocks (Clu-blocks Pro)
What it is: Blocks for using Wi-Fi and connecting to networks.
What it does: Connects your project to Wi-Fi and the Internet.
Example: Connecting your robot to your home internet.
It's the robot's personal router.
Important! Network blocks let your robot go online, send messages, and talk to other devices using Wi-Fi, TCP/UDP sockets, and even get the current time from the internet. It’s like giving your robot a passport to the digital world!
Wi-Fi, Network, Sockets and Internet Communication Blocks
These blocks allow students to connect the ESP32 to a Wi-Fi network, obtain network information, communicate with other devices, create network servers, exchange data using sockets, and synchronize the board's clock through the internet.
They are especially useful for projects involving remote robot control, web pages, wireless sensor monitoring, and communication between the ESP32 and a computer or smartphone.
1. Connect to Wi-Fi
| Block | Block Image | What It Does | Dropdown options | What the Options Mean |
|---|---|---|---|---|
| Connect Using MixIOT | Connects the ESP32 to a Wi-Fi network using the MixIOT helper function. | — | First value: Wi-Fi network name (SSID). Second value: Wi-Fi password. Replace the example text with your network credentials. | |
| Create Wi-Fi Station Interface | Creates a Wi-Fi interface that allows the ESP32 to connect to an existing wireless network. | STA, AP | STA_IF means Station Interface. The ESP32 acts as a client of a Wi-Fi router. | |
| Create Wi-Fi Access Point Interface | Creates a Wi-Fi access point interface so other devices can connect directly to the ESP32. | STA, AP | AP_IF means Access Point Interface. The ESP32 creates its own wireless network. | |
| Activate Wi-Fi | Turns on the selected Wi-Fi interface. | Activate, Deactivate | True enables the interface. | |
| Deactivate Wi-Fi | Turns off the selected Wi-Fi interface. | Activate, Deactivate | False disables the interface. | |
| Check Wi-Fi Interface Status | Checks whether the selected Wi-Fi interface is active. | — | Returns True if enabled or False if disabled. | |
| Scan Wi-Fi Networks | Searches for nearby wireless networks. | — | Returns information about detected networks, such as their names, MAC addresses, channels, and signal strength. |
2. Connect and Manage Wi-Fi
| Block | Block Image | What It Does | Dropdown options | What the Options Mean |
|---|---|---|---|---|
| Connect to Wi-Fi Network | Attempts to connect the ESP32 to a wireless network. | — | First value: network name (SSID). Second value: network password. The example '127.16.0.8' is being used as a text value, not as a network address in this function. | |
| Check Wi-Fi Connection | Checks whether the ESP32 is successfully connected to a network. | — | Returns True if connected or False if not connected. | |
| Get IP Address | Retrieves the ESP32's local IP address. | IP address, subnet mask, Gateway, DNS | [0] selects the first value returned by ifconfig(). | |
| Get Subnet Mask | Retrieves the network subnet mask. | IP address, subnet mask, Gateway, DNS | [1] selects the second value returned by ifconfig(). | |
| Get Gateway Address | Retrieves the network gateway address, usually the router's IP address. | IP address, subnet mask, Gateway, DNS | [2] selects the third value returned by ifconfig(). | |
| Get DNS Address | Retrieves the DNS server address used by the network. | IP address, subnet mask, Gateway, DNS | [3] selects the fourth value returned by ifconfig(). | |
| Disconnect from Wi-Fi | Disconnects the ESP32 from the current wireless network. | — | No arguments are required. | |
| Get Wi-Fi Network Name | Retrieves the configured Wi-Fi network name. | — | 'essid' identifies the network name setting. |
3. Configure the Wi-Fi Access Point
| Block | Block Image | What It Does | Dropdown options | What the Options Mean |
|---|---|---|---|---|
| Configure Access Point | Configures access point settings, including its network name and wireless channel. | Wi-Fi channel | essid: name of the network created by the ESP32. channel: Wi-Fi channel number. The example name is text, not an IP address. |
4. Check Connection and Receive Server Data
| Block | Block Image | What It Does | Dropdown options | What the Options Mean |
|---|---|---|---|---|
| Check and Reconnect to Wi-Fi | Checks whether the ESP32 is disconnected and executes the indented instructions if it is not connected. | — | not reverses the connection result. If isconnected() returns False, the condition becomes True. |
5. Create Network Sockets
A socket is a communication endpoint that allows the ESP32 to exchange data with another device over a network.
| Block | Block Image | What It Does | Dropdown options | What the Options Mean |
|---|---|---|---|---|
| Create TCP Socket | Creates a TCP socket for reliable communication between devices. | TCP, UDP | AF_INET: uses IPv4 addresses. SOCK_STREAM: selects TCP, which establishes a connection before exchanging data. s: variable that stores the socket. | |
| Create UDP Socket | Creates a UDP socket for sending and receiving messages without establishing a permanent connection. | TCP, UDP | AF_INET: uses IPv4 addresses. SOCK_DGRAM: selects UDP, which sends individual data packets. | |
| Bind Socket to Address | Assigns a local address and port to the socket so it can receive incoming connections or data. | — | '0.0.0.0': listens on all available local IPv4 interfaces. 80: port number, commonly used for HTTP communication. | |
| Connect to Remote Server | Establishes a connection to a remote server using its domain name and port. | — | 'clu-block.org': server domain. 80: destination port. getaddrinfo(): resolves the domain name into network address information. [0][-1]: extracts the socket address from the returned information. | |
| Listen for Connections | Places a TCP socket in listening mode so it can accept incoming connection requests. | — | 5: maximum number of pending connections allowed in the waiting queue (backlog). |
6. Accept and Receive TCP Data
| Block | Block Image | What It Does | Dropdown options | What the Options Mean |
|---|---|---|---|---|
| Accept TCP Connection | Waits for an incoming client connection and accepts it. | — | Returns two values: a new socket for communicating with the client and the client's address. | |
| Receive TCP Data | Receives data from a connected TCP client. | — | 1024: maximum number of bytes to receive in this operation. The received data is returned as bytes. |
7. Send TCP Data
| Block | Block Image | What It Does | Dropdown options | What the Options Mean |
|---|---|---|---|---|
| Send Integer as Data | Attempts to convert the text into an integer and send it through the socket. | toInt, toFloat, transfer byte, bytetoInt | int() converts text containing a valid whole number into an integer. The example 'Clu-Bots' is not a valid integer and will cause an error. | |
| Send Decimal as Data | Attempts to convert the text into a decimal number and send it through the socket. | toInt, toFloat, transfer byte, bytetoInt | float() converts valid numeric text into a decimal number. The example 'Clu-Bots' is not a valid number and will cause an error. | |
| Send Encoded Text | Converts text into bytes and sends it through the TCP socket. | toInt, toFloat, transfer byte, bytetoInt | 'Clu-Bots': message to send. .encode("utf-8"): converts the text into UTF-8 bytes, which can be transmitted through the socket. | |
| Convert Bytes to Integer | Attempts to interpret data as bytes and convert it into an integer before sending it. | toInt, toFloat, transfer byte, bytetoInt | "big" specifies big-endian byte order. The example passes a string instead of bytes, so it will cause an error. Use encoded text as the input to int.from_bytes() if this conversion is intended. |
8. Receive and Send UDP Data
| Block | Block Image | What It Does | Dropdown options | What the Options Mean |
|---|---|---|---|---|
| Receive UDP Data | Receives a UDP packet and identifies the device that sent it. | — | 1024: maximum number of bytes to receive. Returns two values: the received data and the sender's address. | |
| Send UDP Integer | Attempts to convert text into an integer and send it to a destination using UDP. | toInt, toFloat, transfer byte, bytetoInt | First value: data to send. Second value: destination IP address and port. The example text is not a valid integer and will cause an error. | |
| Send UDP Decimal | Attempts to convert text into a decimal number and send it to a destination using UDP. | toInt, toFloat, transfer byte, bytetoInt | First value: data to send. Second value: destination IP and port. The example text is not a valid number and will cause an error. | |
| Send UDP Encoded Text | Converts text into UTF-8 bytes and sends it to a specific device using UDP. | toInt, toFloat, transfer byte, bytetoInt | First value: message converted into bytes. Second value: destination IP address and port. | |
| Convert Bytes to Integer and Send UDP | Attempts to convert data into an integer and send it to a destination using UDP. | toInt, toFloat, transfer byte, bytetoInt | "big" specifies big-endian byte order. The example passes a string instead of bytes, so it will cause an error. |
9. Close the Connection and Synchronize Time
| Block | Block Image | What It Does | Dropdown options | What the Options Mean |
|---|---|---|---|---|
| Close Socket | Closes the socket and releases its network resources. | — | No arguments are required. Use when communication is finished. | |
| Synchronize Internet Time | Requests the current time from an internet time server using the Network Time Protocol (NTP). | — | host: address of the time server. 'time1.google.com' identifies the server used in this example. The exact return value and whether the board's clock is updated depend on the MicroPython library implementation. |
Important notes
- SSID and IP address are different: When using
wlan.connect(), the first argument is the Wi-Fi network name, not an IP address. - Station mode (STA_IF): Connects the ESP32 to an existing Wi-Fi router.
- Access Point mode (AP_IF): Allows the ESP32 to create its own Wi-Fi network for other devices to join.
- IP address: The ESP32 needs an IP address to communicate with other devices on a network.
- TCP: Establishes a connection and provides reliable, ordered data delivery. Useful for web servers and applications where complete data delivery matters.
- UDP: Sends independent packets without establishing a connection. Useful for lightweight messages and some real-time applications.
- Ports: A port identifies a particular communication service on a device. Port
80is commonly used for HTTP. - Bytes and text: Network sockets generally send and receive bytes. Use
.encode("utf-8")to convert text into bytes. - NTP: Requires a working internet connection to obtain time from an external server.
- Library dependency:
mixiot,server, and some of the network helper functions depend on the specific Clu-Bots environment.
Quick Tips for Students
- Use Wi-Fi setup first no internet, no networking!
- Use STA mode to connect to a router, or AP mode to create your own hotspot.
- Use TCP for reliable chat, UDP for fast messages like games or sensors.
- Use NTP blocks to get the real-world time perfect for timestamps or alarms.
- Always check IP and status before sending data it helps avoid bugs!
1. Simple Wi-Fi Connection
[ INSERT BLOCK IMAGE HERE: Connect Wi-Fi ]
The first Wi-Fi block provides a simplified connection operation.
The supplied example generates:
Python
mixiot.wlan_connect(
'wifiname',
'wifipassword'
)
The block supplies:
Wi-Fi Name
Plain Text
wifiname
Password
Plain Text
wifipassword
Conceptually:
NETWORK NAME + PASSWORD → CONNECT
This is the simplest Wi-Fi connection concept for beginners.
2. Configuring the Wi-Fi Mode
[ INSERT BLOCK IMAGE HERE: Configure Wi-Fi Mode ]
The actual generation confirms two interface modes.
STA
Python
wlan = network.WLAN(network.STA_IF)
AP
Python
wlan = network.WLAN(network.AP_IF)
So the selector can now accurately be documented as:
| Selection | Generated Interface |
|---|---|
| STA | network.STA_IF |
| AP | network.AP_IF |
For beginning students, the important conceptual distinction is:
STA
Used by the block to create the station interface.
AP
Used by the block to create the access-point interface.
The beginner sequence should start with STA when the objective is connecting to an existing Wi-Fi network.
3. Activating and Deactivating the Interface
[ INSERT BLOCK IMAGE HERE: Activate Network Interface ]
The original image showed Activate, but the real generator confirms both states.
Activate
Python
wlan.active(True)
Deactivate
Python
wlan.active(False)
Therefore:
| Selection | Generation |
|---|---|
| Activate | active(True) |
| Deactivate | active(False) |
Conceptually:
CONFIGURE INTERFACE → ACTIVATE → USE
4. Checking the Interface Active State
[ INSERT BLOCK IMAGE HERE: Get Active Status ]
The corresponding block generates:
Python
wlan.active()
This obtains the current active-state value of the interface.
That gives us an important distinction:
Set State
Python
wlan.active(True)
Get State
Python
wlan.active()
For students:
SET → Change something
GET → Read something
5. Scanning for Wi-Fi Networks
[ INSERT BLOCK IMAGE HERE: Scan Wi-Fi ]
The block generates:
Python
wlan.scan()
Conceptually:
D1 R32 → SCAN → Available Wi-Fi Information
For learning and troubleshooting, the scan result can be sent to the PC using Serial.
Wi-Fi Scan → Serial Port → PC
This makes an otherwise invisible network operation observable.
6. Connecting the Configured wlan
[ INSERT BLOCK IMAGE HERE: wlan Connect Wi-Fi ]
The supplied example generates:
Python
wlan.connect(
'127.16.0.8',
'01234567'
)
The two block fields supply:
- Network name
- Password
Conceptually:
Configured wlan + Credentials → Connect
This is different from the earlier simplified mixiot.wlan_connect() block because this operation explicitly uses the previously configured:
Python
wlan
interface.
7. Checking Whether Wi-Fi Is Connected
[ INSERT BLOCK IMAGE HERE: Wi-Fi Connect State ]
The actual operation is:
Python
wlan.isconnected()
Conceptually:
Wi-Fi → Connected? → Result
This can naturally feed into Logic and Control:
Wi-Fi Connected?
↓
TRUE / FALSE
↓
IF
↓
Next Action
🧠 A good network program should distinguish between requesting a connection and checking the resulting connection state.
8. Getting Wi-Fi Network Information
[ INSERT BLOCK IMAGE HERE: Get Wi-Fi Information ]
This block is considerably more capable than the original screenshot revealed.
The real generator confirms four indexes:
Python
wlan.ifconfig()[0]
wlan.ifconfig()[1]
wlan.ifconfig()[2]
wlan.ifconfig()[3]
The previously visible selection was:
IP address
which corresponds to the real generated:
Python
wlan.ifconfig()[0]
For the remaining selector labels, we should use the actual names displayed in Clu-Blocks Pro's menu when they are available rather than inventing labels solely from the array indexes.
Technically, however, we can safely document that the block provides selectors generating:
ifconfig()[0] through ifconfig()[3].
9. Disconnecting Wi-Fi
[ INSERT BLOCK IMAGE HERE: Disconnect Wi-Fi ]
The block generates:
Python
wlan.disconnect()
This ends the Wi-Fi connection associated with the configured interface.
The complete beginner Wi-Fi cycle therefore becomes:
CONFIGURE → ACTIVATE → CONNECT → CHECK → USE → DISCONNECT
10. Access Point Information
[ INSERT BLOCK IMAGE HERE: Get Access Point Information ]
The actual generation confirms two AP configuration queries.
ESSID
Python
wlan.config('essid')
Channel
Python
wlan.config('channel')
Therefore, the selector provides at least these two confirmed operations:
ESSID
and:
Channel
The visible block wording can continue using the interface's own label, while the technical explanation documents the exact generated property.
11. Setting Access Point Information
[ INSERT BLOCK IMAGE HERE: Set Access Point ]
The supplied example generates:
Python
wlan.config(
essid = '127.16.0.8',
channel = 1
)
The block therefore configures:
ESSID
Plain Text
127.16.0.8
Channel
Plain Text
1
Conceptually:
AP NAME / ESSID + CHANNEL → CONFIGURE ACCESS POINT
This block belongs with AP mode, not with the initial beginner STA connection workflow.
12. Start Server
[ INSERT BLOCK IMAGE HERE: Start Server ]
The real Clu-Blocks Pro generation for this server operation is more substantial than the visible block suggests:
Python
if not wlan.isconnected():
connectWifi(SSID, PASSWORD)
ip = wlan.ifconfig()[0]
print(ip)
time.sleep(1)
DATA = listenData()
This confirms that the generated server sequence:
- Checks the Wi-Fi connection.
- Calls
connectWifi(SSID, PASSWORD)when the generated condition requires it. - Obtains
ifconfig()[0]. - Prints the value.
- Waits 1 second.
- Calls
listenData().
For the student-facing manual, I would simplify this to:
Starts the server workflow generated by Clu-Blocks Pro and obtains incoming data through the corresponding server library operations.
The generated details can remain in the technical reference.
🔌 Socket Communication
The second major half of Network introduces sockets.
The real code confirms two socket types:
TCP
and:
UDP
These are significantly more advanced than simply connecting to Wi-Fi.
Teaching recommendation: students should understand Wi-Fi connection, connection state, and IP information before beginning socket communication.
13. Creating a TCP Socket
[ INSERT BLOCK IMAGE HERE: Socket Init ]
When TCP is selected, Clu-Blocks Pro generates:
Python
s = socket.socket(
socket.AF_INET,
socket.SOCK_STREAM
)
The created socket is:
Plain Text
s
The important student concept is:
TCP → SOCK_STREAM
14. Creating a UDP Socket
When UDP is selected, the same block generates:
Python
s = socket.socket(
socket.AF_INET,
socket.SOCK_DGRAM
)
Therefore:
| Block Selection | Generated Type |
|---|---|
| TCP | SOCK_STREAM |
| UDP | SOCK_DGRAM |
This is a major improvement over the original version, where only TCP was visibly selected.
15. Binding a Socket
[ INSERT BLOCK IMAGE HERE: Bind Socket ]
The supplied example generates:
Python
s.bind(('0.0.0.0', 80))
The block contains:
Address
Plain Text
0.0.0.0
Port
Plain Text
80
Conceptually:
SOCKET + ADDRESS + PORT → BIND
For beginner documentation, that relationship is enough. The deeper networking meaning of individual special addresses can be introduced in later networking lessons.
16. Connecting a Socket
[ INSERT BLOCK IMAGE HERE: Connect Socket ]
The visible example uses:
Plain Text
clu-block.org
and:
Plain Text
80
Clu-Blocks Pro generates:
Python
s.connect(
socket.getaddrinfo(
'clu-block.org',
80
)[0][-1]
)
This reveals an important detail:
The destination field can be supplied to:
Python
socket.getaddrinfo(...)
before the connection is made.
At the block level, students can think:
Socket + Domain/IP + Port → Connect
17. Listen
[ INSERT BLOCK IMAGE HERE: Socket Listen ]
The visible queue value is:
Plain Text
5
and the generated operation is:
Python
s.listen(5)
The numerical field is supplied directly to listen().
For beginner documentation, the key concept is:
Socket → Listen
Detailed queue semantics can be introduced later rather than overloading the first socket lesson.
18. Accept
[ INSERT BLOCK IMAGE HERE: Accept Socket ]
The block generates:
Python
s.accept()
This is the socket accept operation exposed by Clu-Blocks Pro.
For the student-facing explanation:
LISTEN → ACCEPT CONNECTION
This belongs to the more advanced server-side socket workflow.
19. TCP Receive
[ INSERT BLOCK IMAGE HERE: TCP Receive ]
The example generates:
Python
s.recv(1024)
The supplied value is:
Plain Text
1024
Conceptually:
TCP Socket → RECEIVE → Data
The 1024 value is supplied as the argument to recv().
20. TCP Send
[ INSERT BLOCK IMAGE HERE: TCP Send ]
This block contains one of the most important hidden selectors in the Network category.
The actual code confirms four data-conversion forms.
Integer
Python
s.send(int('Clu-Bots'))
Float
Python
s.send(float('Clu-Bots'))
UTF-8
Python
s.send('Clu-Bots'.encode("utf-8"))
Integer from Bytes
Python
s.send(
int.from_bytes(
'Clu-Bots',
"big"
)
)
Therefore, the Send block does not simply contain one toInt option. The selector controls how the supplied content is converted before being passed to send().
21. TCP Send Conversion Options
| Confirmed Conversion | Generated Form |
|---|---|
| Integer | int(value) |
| Float | float(value) |
| UTF-8 | value.encode("utf-8") |
| Integer from Bytes | int.from_bytes(value,"big") |
For the final manual, I recommend using the exact labels displayed by the Clu-Blocks Pro selector once those labels are available.
The MicroPython reference confirms the four actual generated conversion behaviors.
22. UDP Receive
[ INSERT BLOCK IMAGE HERE: UDP Receive ]
UDP uses a different receive operation:
Python
s.recvfrom(1024)
This should remain distinct from TCP:
TCP
Python
s.recv(1024)
UDP
Python
s.recvfrom(1024)
Students should recognize that TCP and UDP have their own corresponding receive blocks.
23. UDP Send
[ INSERT BLOCK IMAGE HERE: UDP Send ]
The UDP send operation includes:
- Content
- Conversion
- Destination
- Port
The supplied reference confirms forms such as:
Python
s.sendto(
'Clu-Bots'.encode("utf-8"),
('127.0.0.1', 80)
)
The example destination is:
Plain Text
127.0.0.1
and the example port is:
Plain Text
80
Conceptually:
DATA + DESTINATION + PORT → UDP SEND
24. UDP Conversion Options
The UDP Send block confirms the same four conversion patterns.
Integer
Python
s.sendto(
int('Clu-Bots'),
('127.0.0.1', 80)
)
Float
Python
s.sendto(
float('Clu-Bots'),
('127.0.0.1', 80)
)
UTF-8
Python
s.sendto(
'Clu-Bots'.encode("utf-8"),
('127.0.0.1', 80)
)
Integer from Bytes
Python
s.sendto(
int.from_bytes('Clu-Bots',"big"),
('127.0.0.1', 80)
)
So:
TCP Send
and:
UDP Send
share the same confirmed conversion family in the supplied Clu-Blocks Pro generation.
25. TCP vs. UDP in Clu-Blocks Pro
For the block manual, the differences can initially be kept simple.
| TCP Blocks | UDP Blocks |
|---|---|
SOCK_STREAM | SOCK_DGRAM |
recv() | recvfrom() |
send() | sendto() |
| Socket connection operations are available. | sendto() contains destination information directly. |
Students do not need a full networking-theory lesson at this point.
The first goal is recognizing that:
TCP and UDP are two different socket communication paths represented by different Clu-Blocks Pro operations.
26. Closing the Socket
[ INSERT BLOCK IMAGE HERE: Close Socket ]
The final socket-management operation generates:
Python
s.close()
Conceptually:
CREATE → USE → CLOSE
This gives students a clear lifecycle for a socket.
27. Network Time
[ INSERT BLOCK IMAGE HERE: Network Time ]
The supplied example uses:
Plain Text
time1.google.com
and generates:
Python
ntptime.time(
host='time1.google.com'
)
This uses the supplied host in the NTP time operation exposed by Clu-Blocks Pro.
Conceptually:
NETWORK → NTP HOST → TIME VALUE
For students, the important first concept is:
Once the D1 R32 has network connectivity, the program can use network-based services such as the NTP operation provided by this block.
Wi-Fi vs. Network Services
This category becomes easier if students understand the layers.
Layer 1: Wi-Fi
Get connected
Layer 2: Network Information
Check state / inspect configuration
Layer 3: Communication
TCP / UDP
Layer 4: Network Services
Server / NTP
So the progression is:
CONNECT → VERIFY → COMMUNICATE → USE SERVICES
Network + HTTP
The next category, HTTP, naturally builds on Network.
Conceptually:
D1 R32
↓
Wi-Fi
↓
Network Connection
↓
HTTP Request
↓
Web Resource
↓
Response
This makes the curriculum progression very logical:
NETWORK first → HTTP afterward
Students should understand that HTTP is not the Wi-Fi connection itself. HTTP operates using network connectivity.
Using Serial Port While Learning Network
For your course, Serial should remain central.
First
Report the connection state:
Wi-Fi → isconnected() → Serial Port → PC
Then
Report network configuration:
Wi-Fi → IP Address → Serial Port → PC
Later
Observe communication:
TCP/UDP Receive → Serial Port → PC
This preserves the course's learning pattern:
CONNECT → OBSERVE → VERIFY → COMMUNICATE
Quick Guide for Students
- Do I simply need to connect to Wi-Fi? Use: Connect Wi-Fi
- Do I need a configured Wi-Fi interface? Use: Configure Wi-Fi
- Which modes are confirmed? STA / AP
- Do I need to enable or disable the interface? Use: Activate / Deactivate
- Do I want to find Wi-Fi networks? Use: Scan
- Do I need to know whether Wi-Fi connected? Use: Wi-Fi Connect State
- Do I need network configuration information? Use: Get Wi-Fi Information
- Do I want to disconnect? Use: Disconnect Wi-Fi
- Do I need an Access Point configuration? Use: AP mode + ESSID / Channel blocks
- Do I need TCP? Use: TCP Socket → Send / Receive
- Do I need UDP? Use: UDP Socket → Send / Receive
- Do I need network time? Use: NTP
Quick Reference
| Family | Confirmed Generation | Main Idea |
|---|---|---|
| Simple Wi-Fi | mixiot.wlan_connect() | Connect with name/password. |
| STA Mode | network.STA_IF | Create STA interface. |
| AP Mode | network.AP_IF | Create AP interface. |
| Activate | active(True) | Activate interface. |
| Deactivate | active(False) | Deactivate interface. |
| Active State | active() | Read active state. |
| Scan | scan() | Scan Wi-Fi networks. |
| Connect | connect() | Connect configured interface. |
| Connected? | isconnected() | Check connection state. |
| Network Info | ifconfig()[0..3] | Obtain selected configuration value. |
| Disconnect | disconnect() | Disconnect Wi-Fi. |
| ESSID | config('essid') | Obtain ESSID configuration. |
| Channel | config('channel') | Obtain channel configuration. |
| Configure AP | config(essid=...,channel=...) | Configure ESSID and channel. |
| TCP Socket | SOCK_STREAM | Create TCP socket. |
| UDP Socket | SOCK_DGRAM | Create UDP socket. |
| Bind | bind() | Bind address/port. |
| Connect Socket | connect(getaddrinfo(...)) | Connect to destination. |
| Listen | listen() | Socket listen operation. |
| Accept | accept() | Accept operation. |
| TCP Receive | recv() | Receive TCP data. |
| TCP Send | send() | Send TCP data. |
| UDP Receive | recvfrom() | Receive UDP data. |
| UDP Send | sendto() | Send UDP data to destination/port. |
| Close | close() | Close the socket. |
| NTP | ntptime.time(host=...) | Network-time operation. |
