Uno – ESP32 SoftwareSerial communication won’t work

I have two boards, Uno and ESP32 and my goal is to send data from the Uno to the ESP. I made a voltage divider so my ESP doesn’t get fried and I use the communication only in ONE way, strictly UNO -> ESP32. I use PIN 9 from my UNO to send data and RX2 (16) from my ESP to receive the data. How ever, I get errors and can’t make it work.

This is my Uno code:

#include <SoftwareSerial.h>

SoftwareSerial softPort(-1, 9);

void setup() {
Serial.begin(9600);
softPort.begin(9600);
}

void loop() {
softPort.print("100");
delay(2000);

}

and my ESP code:

#include <SoftwareSerial.h>

#define RXD2 16
#define TXD2 -1

SoftwareSerial Serial2(RXD2, TXD2); // RX, TX

void setup() {
Serial.begin(115200);
Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);

}

void loop() {
Serial.println("Data received:");
Serial.println(Serial2.read());
delay(200);

}

I’m getting an error that says

no matching function for call to ‘SoftwareSerial::begin(int, int, int, int)’

Xổ số miền Bắc