diff --git a/rosserial_arduino/src/ros_lib/ArduinoHardware.h b/rosserial_arduino/src/ros_lib/ArduinoHardware.h index 08fbbd5e6..2450a83d3 100644 --- a/rosserial_arduino/src/ros_lib/ArduinoHardware.h +++ b/rosserial_arduino/src/ros_lib/ArduinoHardware.h @@ -59,7 +59,15 @@ #define SERIAL_CLASS USBSerial #else #include // Arduino AVR - #define SERIAL_CLASS HardwareSerial + #if defined(USE_USBCDC) + // ESP32-S2 ESP32-C3 + #define SERIAL_CLASS USBCDC + #elif defined(USE_HWCDC) + // ESP32-S3 + #define SERIAL_CLASS HWCDC + #else + #define SERIAL_CLASS HardwareSerial + #endif #endif class ArduinoHardware {