MKRWAN_v2.h Example errors / modem.setPort() function?

Hi there.

I bought an MKRWAN1310 and use the examples of the MKRWAN_v2 library.
I connect to TTN like it is shown in your this Tutorial:

Therefore no need to upload the sketches.

When I use the FirstConfiguration sketch the payload will be delivered properly:


When i use the LoraSendAndRecieve sketch the same payload is gibberish:

The difference was that in the LoraSendAndRecieve sketch the port wasn't set like it was in the FirstConfiguration sketch on line 83 >> modem.setPort(3);

When I set the port in the other script as well by adding modem.setPort(3); the payload will be delivered correct again.

My Question is why modem.setPort(3) isn't in the LoraSendAndRecieve sketch and what does the function do?

And why I get a error from the modem.endpacket(true) in both cases, when I get a false payload and a correct one?

Best

Pascal