Any ideas?

All of the numbers in your program are decimal.

When you send decimal 11111 to a byte-printing function, it looks at the eight least significant bits (binary).

The sixteen-bit decimal number 11111 is equal to binary 0010101101100111 and the five least significant bits are "00111", which is what you are seeing as the character is displayed.

If you want a bit pattern consisting of five ones in the least significant bits you can use one of the binary constants #defined in Arduino's binary.h to make it easy to see what the heck it is:

mySerial.print(B00011111, BYTE);

Now it "just happens" that the sixtteen-bit decimal number 11101 is equal to binary 0010101101011101, so the five least significant bits are "11101" Maybe you just got lucky. (Or maybe it is actually unlucky, since it gave you the false sense of correctness arising from seeing from what you wanted to see).

Anyhow---a better (less obfuscatory) way of specifying a byte whose five least significant bits are "11101" is with

mySerial.print(B00011101, BYTE);

Regards,

Dave