2 Serial conections on arduino zero

Hello everyone!
I want to take some date from a esp8266 and upload it to the serial monitor with a arduino zero but i need 2 serial chanels for that to work:
1 chanel for uart
1 chanel for the esp8266
So i did a bit of resarch and i got this code

#include <Arduino.h>   // required before wiring_private.h
#include "wiring_private.h" // pinPeripheral() function

Uart Serial2 (&sercom3, 7, 6, SERCOM_RX_PAD_3, UART_TX_PAD_2);
void SERCOM3_Handler()
{
  Serial2.IrqHandler();
 
}

void setup() {
 

  Serial2.begin(115200);
  Serial.begin(115200);
   // Assign pins 10 & 11 SERCOM functionality
pinPeripheral(0, PIO_SERCOM); //Assign RX function to pin 0
 pinPeripheral(1, PIO_SERCOM); //Assign TX function to pin 1

 pinPeripheral(5, PIO_SERCOM); //Assign RX function to pin 5
 pinPeripheral(4, PIO_SERCOM); //Assign TX function to pin 4
}

void loop() {
  
if (Serial2.available()){
  Serial.print(Serial2.read());
}
}

Which doesn’t seem to work!
I connect my esp8266 like this:
ESP8266 ARDUINO
RX<--------------------------->5
TX<--------------------------->4

Just use the native USB CDC ACM port for the Serial monitor, and use UART0 (pins 0 and 1) to connect the ESP8266.

Pieter

How?
I conect my pc to the native port of the zero and the esp to pins 1,2?

No, pins 0 and 1 (labeled RX and TX).

ok but still it doesn't work
i connected like you said and it doesn't work

What code did you use?

It had no code,i mean the blank sketch

Andreiva:
It had no code,i mean the blank sketch

Well, no surprise then ...

Do you need the Arduino, or do you just want to use it as a USB-to-Serial adapter?

Nvm i found something that seems to work now,thanks