Skip to content

HardwareSerial multiple definition #1838

@atsteich

Description

@atsteich

I'm not really familar with the esp32, and I'm getting a real strange error...
I installed the esp32 in an local arduino ide, no other packages installed.

when running the following code:

`HardwareSerial Serial1(1);

#define RXD2 16
#define TXD2 17

void setup() {
Serial.begin(115200);
Serial1.begin(9600, SERIAL_8N1, RXD2, TXD2);
Serial.println("Serial Txd is on pin: "+String(TX));
Serial.println("Serial Rxd is on pin: "+String(RX));
}

void loop() {
while (Serial2.available()) {
Serial.print(char(Serial2.read()));
}
}`

I get an error message saying that there is a multiple definition of Serial1. I have absolutely no idea what I am doing wrong, since there are lot of examples using exactly this code...

When I remove the line " HardwareSerial Serial2(2) " the script can be compiled and uploaded, but still it is not working when I run some traffic on the specified pins.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleIssue is stale stage (outdated/stuck)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions