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()

	Serial2.begin(115200,SERIAL_8N1,14,15);

and then use Serial2 as normal

Hi,
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 );

Setrup()
{
 Serial.begin( SerialDataBits );
  SerialBrain.begin( SerialDataBits );
  SerialTFMini.begin(  SerialDataBits, SERIAL_8N1, 27, 26 );
  // Initialize the TFMini LIDAR
  tfmini.begin(&SerialTFMini);
}

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.