After a lot of fighting, I have managed to recall what I did about six months ago to manage communicaton between ESP32S2 (ES32-S2F) and Serial Monitor. Now, it works:
A: Setup:
Arduino IDE 2.2.1
Board: ESP32S2 dev Module
Port: COM3 (Deneyap Mini)
USB CDC on Boot: "Enabled" //(default option)
Upload Mod: "UART0" //(default option)
Upload Speed: "921600" //(default option)
B: Sketch:
char myData[20];
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(15, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(15, HIGH); // turn onBoard LED
delay(1000); // wait for a second
digitalWrite(15, LOW); // turn off onBoard LED
delay(1000); // wait for a second
byte n = Serial.available(); //receive string from InputBox of Serial Monitor
if (n != 0) {
byte m = Serial.readBytesUntil('\n', myData, sizeof myData - 1);
myData[m] = '\0'; //null character
Serial.println(myData); //Send back the received string to OutputBox of SM
}
}
C: Input/Output:
Are you here?
D: Operation:
1. Check Deiice Manager, and I have fond like this:
Ports ==> USB Serial Device (COM3)
2. Click Upload.
There could be connection fault and uploading is aborted.
3. There is a dong sound.
4. Open Device Manage. I have found like this:
Ports ==> USB Serial Device (COM3)
Other Devices ==> ESP32-S2
5. Click on Upload. The sketch is uploaded. The onBoard LED is blinking.
6. Open Serial Monitor with newline opton in Line ending box. Enter this string: "Are you here?" in the InputBox (Fig-1) of Serial Monitor and then click on the Send Button. Check that the same message has appeared on the OutputBox of Serial Monitor.
Figure-1:
7. Reading the posts of this thread may worth.
