What makes this odder (for me anyway) is that I used an ESP32-C3-Mini on another project and was able to both upload the code and use the USB port for serial communications just fine. It is my understanding that both the C3 and S3 have internal USB-to-Serial support.
FYI: I am using Visual Studio 2023 with the VisualMicro extension for the IDE.
Any insight is most appreciated.
Code: Select all
/*
Name: USBComTest.ino
Created: 8/29/2024
*/
/*********************************************************************
This is the code is just to test the ability to program and
communicate over the USB port on the ESP32-S3.
*********************************************************************/
#include <Arduino.h>
/********************REVISION HISTORY********************************
0.0 08/29/24
Inital unreleased development
*********************************************************************/
// Define the command terms
constexpr auto CmdArraySize = 8; // Maximum number of parameters in any command elements
String Cmd[CmdArraySize]; // The command array received
bool CmdIsValid; // The command received is valid
/////////////////////////////////////////// SETUP ////////////////////////////////////////////////////////
void setup() {
// Setup the serial com port
Serial.begin(115200);
Serial.setTimeout(20);
//while (!Serial);
delay(500);
Serial.println("---------------------");
Serial.println(" USB Serial Com Test");
Serial.println("---------------------");
}
//////////////////////////////////////////// LOOP /////////////////////////////////////////////////////////////
void loop() {
// Check to see if there is a serial command was received
byte i = 0;
byte ch;
char charSerial[127];
// Serial data available
while (Serial.available()) {
ch = Serial.read();
if ((ch == '\r') || (ch == '\n')) {
charSerial[i] = '\0';
Serial.println(charSerial);
i = 0;
}
else {
charSerial[i] = (char)ch;
i++;
}
}
delay(10); // Slow things down just a bit
}