Serial Communication with other device on esp32

Hi everyone. I’m trying to establish a serial communication between my DOIT ESP32 DEVKIT V1 and Arduino UNO for my project. Arduino is able to send the data via serial but I cannot read and print it via the SERIAL 2 serial port. The code I wrote is the following:

import streams

s = streams.serial(SERIAL2)

while True:

length=s.available() # check if data are available on the port and count them
chars=s.read(length) # read all the bytes available in the buffer an return the bytearray 

sleep(1000)

print("LETTO IN INPUT : ", chars)

sleep(500)

baud rate is the same and i connect TX-RX RX-TX of Arduino and ESP32 by logic level converter
for the fact that arduino works at 5V and my board at 3.3V

I use a fota VM. This is my output

?P?V??ET?Q?UU?T??-?QZQUVR??U?UTTJ??ZqT??T?J?R?J?u?uT?T??U???-QBU??j??EJ?R?Zq??R?Zq?uT?Zq???R?Zq??W??Q(???Q(E???I???T?U?UZUEu????(??UVKEu????(?J?jZUEuP?+??T????Q??T?\E??Q?UV???D?Qi???U?u??Q??T?\EQE??jZj?Ej??PqQQ?TTE (65) boot: OTA: 0/0 0/0 0/1

E (65) boot: Starting vm 0

Thanks everyone

i connect the grounds too

We should start debugging this by ensuring that you are configuring Serial2 correctly.
Here is an example of writing to multiple serial instances:

import streams
streams.serial()

s0=streams.serial(SERIAL0,set_default=True)
s1=streams.serial(SERIAL1,baud=9600) ## define second serial port

while True:
    print("Write some chars on the serial port and terminate with \\n (new line)",stream=s0)
    line=s0.readline() # read and return any single character available on the serial port until a \n is found
    print("You wrote:", line,stream=s0)
    sleep (300)

Edit S1 to be serial2 and adjust the baudrate.
if it still not working check with a usb to ttl converter if you are recieving everything correctly.
Then if all fails, check the code on the arduino side.

Thanks so much for the quick reply. in truth yesterday I was able to solve this situation but now I have another problem

my code arduino is :

int x = 45;
void setup() {

Serial.begin(115200);
}

void loop() {

Serial.write(x);
delay(500);

}

and my code zerynth is :

import streams

s = streams.serial(SERIAL2)
s1 = streams.serial(SERIAL0,set_default=True)

while True:

length=s.available() # check if data are available on the port and count them
chars= s.read(length) # read all the bytes available in the buffer an return the bytearray 


print("from arduino : ", chars)

sleep(500)

But i have ‘—’ in output. — is 45 (i checked it by , ord(’—’)) but i can’t convert it in int :cry:

I am not sure I understand.
Which microcontroller’s output is printing ‘—’?
Do you want to print the hex of ‘—’?