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

Hello.
I have a Wroom 32 module programming error in the hardwareserial.
can anyone help me please!

ERROR:

testGPS:4:27: error: no matching function for call to 'HardwareSerial::HardwareSerial(int)'

 HardwareSerial GPSSerial(1);

                           ^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:233:0,

                 from sketch\testGPS.ino.cpp:1:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:117:12: note: candidate: HardwareSerial::HardwareSerial(volatile uint8_t*, volatile uint8_t*, volatile uint8_t*, volatile uint8_t*, volatile uint8_t*, volatile uint8_t*)

     inline HardwareSerial(

            ^~~~~~~~~~~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:117:12: note:   candidate expects 6 arguments, 1 provided

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:93:7: note: candidate: constexpr HardwareSerial::HardwareSerial(const HardwareSerial&)

 class HardwareSerial : public Stream

       ^~~~~~~~~~~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:93:7: note:   no known conversion for argument 1 from 'int' to 'const HardwareSerial&'

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:93:7: note: candidate: constexpr HardwareSerial::HardwareSerial(HardwareSerial&&)

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:93:7: note:   no known conversion for argument 1 from 'int' to 'HardwareSerial&&'

C:\Users\DELL\Documents\Arduino\testGPS\testGPS.ino: In function 'void setup()':

testGPS:10:38: error: no matching function for call to 'HardwareSerial::begin(int, int, int, int)'

   GPSSerial.begin(9600,SERIAL_8N1,3,1);

                                      ^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:233:0,

                 from sketch\testGPS.ino.cpp:1:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:121:10: note: candidate: void HardwareSerial::begin(long unsigned int)

     void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }

          ^~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:121:10: note:   candidate expects 1 argument, 4 provided

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:122:10: note: candidate: void HardwareSerial::begin(long unsigned int, uint8_t)

     void begin(unsigned long, uint8_t);

          ^~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:122:10: note:   candidate expects 2 arguments, 4 provided

exit status 1
no matching function for call to 'HardwareSerial::HardwareSerial(int)'


Do you have the board type set correctly in the IDE? You should not be pulling from avr/cores.

Is this your sketch name?

Thank you very much

I did not notice the type of board selected in the ide, the error is gone

But after upload the code , I did not receive anything from the GPS
If you can help me, here is the code:

#include <HardwareSerial.h>
#include <TinyGPS++.h>

HardwareSerial GPSSerial(1);
TinyGPSPlus gps;
String b; 

void setup() {
  Serial.begin(115200);
  GPSSerial.begin(9600,SERIAL_8N1,3,1);
  Serial.println("gps start");
}

void loop() {
  while(GPSSerial.available()>0)
  {
    Serial.println("data received");
    gps.encode(GPSSerial.read());
  }
  if(gps.location.isUpdated()){
    Serial.print("Latitude:");
    Serial.println(gps.location.lat(), 6);
    
    Serial.print("Longitude:");
    Serial.println(gps.location.lng(), 6);
  }
}

I have not used a Wroom 32 or a GPS module so I can't really help there. However, I don't even see the "gps start" message in the serial console so there may be a more fundamental issue going on.

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