HardwareSerial library doesn't have HardwareSerial() function

Hi I want to use HardwareSerial() in my project y that wrote on esp32. part of my code is:

#include <HardwareSerial.h>
HardwareSerial mySerial(2);

but it doesn't compile and get this error:

no matching function for call to 'HardwareSerial::HardwareSerial()

Why exactly do you want to use the HardwareSerial library ?

Using an ESP32 you can define the pins to be used in the begin.function()


and then use Serial2 as normal

Where did you get the "HardwareSerial" library.
If you want to use the hardware uart on the ESP32 you do not need such a library.

This may help.

Tom.... :smiley: :+1: :coffee: :australia:

#include <HardwareSerial.h>
HardwareSerial SerialTFMini( 1 );
HardwareSerial SerialBrain( 2 );

 Serial.begin( SerialDataBits );
  SerialBrain.begin( SerialDataBits );
  SerialTFMini.begin(  SerialDataBits, SERIAL_8N1, 27, 26 );
  // Initialize the TFMini LIDAR

thanks for your solution.my problem is solved. :blush:

Which solution?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.