EasyManua.ls Logo

Freenove ESP32-S3 - Whats next?; End of the Tutorial

Default Icon
142 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Any concerns? support@freenove.com
Chapter 8 Camera Tcp Server
138
www.freenove.com
73
74
75
Serial.println("Camera Error");
}
}
The loopTask_Cmd() function sends the received instruction back to the phone app and prints it out through
a serial port.
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
void loopTask_Cmd(void *pvParameters) {
Serial.println("Task Cmd_Server is starting ... ");
while (1) {
WiFiClient client = server_Cmd.available(); // listen for incoming clients
if (client) { // if you get a client,
Serial.println("Command Server connected to a client.");// print a message out the
serial port
String currentLine = ""; // make a String to hold incoming data from the client
while (client.connected()) { // loop while the client's connected
if (client.available()) { // if there's bytes to read from the client,
char c = client.read(); // read a byte, then
client.write(c);
Serial.write(c); // print it out the serial monitor
if (c == '\n') { // if the byte is a newline character
currentLine = "";
}
else {
currentLine += c; // add it to the end of the currentLine
}
}
}
// close the connection:
client.stop();
Serial.println("Command Client Disconnected.");
}
}
}
loopTask_ Blink()function will control the blinking of LED. When you see LED blinking, it indicates that ESP32-
S3 has been configured and starts working.
112
113
114
115
116
117
118
void loopTask_Blink(void *pvParameters) {
Serial.println("Task Blink is starting ... ");
while (1) {
digitalWrite(LED_BUILT_IN, !digitalRead(LED_BUILT_IN));
delay(1000);
}
}