Week13-Embedded Networking and Communications
Group assignment:
- Send a message between two projects
- Document your work to the group work page and reflect on your individual page what you learned
Individual assignment:
- design, build and connect wired or wireless node(s) with network or bus addresses and a local interface
Checklist
- inked to the group assignment page
- Documented your project and what you have learned from implementing networking and/or communication protocols
- Explained the programming process(es) you used.
- Dutlined problems and how you fixed them.
- ncluded design fles (or inked to where they are located ifyou are using a board you have designed and fabricated earier and original source code
- Included a ‘hero shot of your network and/or communications setup
Group assignment
link
Individual assignment
Because my final project involves two devices communicating with each other, this week I will use two ESP32s to send and receive messages within the same local network.
I divided this week’s task into two parts. First, I will establish the WiFi connection for the ESP32s. Then, I will proceed with setting up communication between them.
server part
I wrote the program and successfully connected to the WiFi.
#include <WiFi.h>
const char* ssid = "P30P"; //wifi id
const char* password = "siyuanff11"; //wifi key
void setup() {
Serial.begin(9600);
WiFi.begin(ssid, password);
}
void loop() {
}
Oh, I found the IP address of my ESP32.
To make it easier for me to view the IP address, I made the following improvements.
#include <WiFi.h>
const char* ssid = "P30P"; //wifi id
const char* password = "siyuanff11"; //wifi key
void setup() {
Serial.begin(9600);
WiFi.begin(ssid, password);
delay(5000);
Serial.println(WiFi.localIP());
}
void loop() {
}
I added the display of WiFi status and IP address, but unfortunately, the serial monitor didn’t show any messages. I checked the example code provided by Arduino and found that I could add the following code.
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
I successfully modified my code and achieved the desired outcome.