Issue while using Serial And Serial1 port

Hi All, I am using Arduino Leonardo board. I want to use keyboard and mouse library for test purpose. They are working properly. But I want to take input from Serial1 and do respective operation on Serial port with use of mouse/KB libraries. Code recieve character from Serial1, and does respective operation as per recieved character. But it is not performing as per character. I tried to sent by hyperterminal. It works for only default case. When I tried to read Serial1 then I found recieved character is different than sent character. Like for char 'u', Serial1 reflects 'V'. For char 'a', it reflects '0'

Could you please tell me where is issue? in code? or else? Do I need to perform different procedure to perform the same?

Here is code: void setup() {

Serial1.begin(9600); Serial.begin(9600); while (! Serial1); while (! Serial); Mouse.begin(); Keyboard.begin(); }

void loop() { // use serial input to control the mouse: if (Serial1.available() > 0) { char inChar =;

switch (inChar) { case 'U': // move mouse up Mouse.move(0, -40); Serial.print("Mouse Up");

Serial1.write(inChar); break; case 'D': // move mouse down Mouse.move(0, 40); Serial.print("Mouse Down");

Serial1.write(inChar); break; default: Mouse.move(40, 40); Serial1.write(inChar); break; }



What is connected to Serial1?

COM1 port of machine is connected to Serial1 and USB is connected to Serial. Also I checked by connecting serial COM port of another machine and sending character through hyper terminal.

Instead of sending the character received on Serial1 back out on Serial1, why not send it out on Serial as a debugging step?