user79688: I am working with an arduino pro micro and I am facing a peculiar problem. The project I am working with includes arduino MKR NB 1500 as well. I am transferring data from MKR NB 1500 to arduino pro micro through Serial1(Rx/Tx pins). I have added the sample code that i am using on both boards
program in arduino MKR NB 1500
void setup() {
  Serial1.begin(9600);
}
void loop() {
  Serial1.print("printing");
  delay(2000);
}

program in pro micro
#include "Keyboard.h"

void setup() {
  Serial1.begin(9600);
  Keyboard.begin();
}

void loop() {
  Keyboard.write(Serial1.read());
}

I would like to transfer some data from MKR NB 1500 to pro micro which emulates a keyboard and prints the data in a editor. I am powering the arduino MKR NB 1500 via USB using its native USB port. The pro micro works as expected when I connect both these boards to USB ports in the same laptop. (Output: printingprintingprintingprinting)
However, the pro micro prints garbage values when I connect the MKR NB 1500 to a USB port belonging to a different laptop. (Output: a10joh<qqj<zstjo)
Is there any reason for such a behavior. Please let me know if you need more information from my side or if i have not made myself clear.

user37622: You have to connect ground between the modules. Without common ground the logic level of signal can't be measured. While both boards were powered over USB from the same laptop the boards had common ground.

read returns -1 if nothing is available so check if some character was received:
void loop() {
  if (Serial1.available()) {
    Keyboard.write(Serial1.read());
  }
}

btw: The MKR can emulate a keyboard too with the Keyboard library.

79688: <p>I am working with an arduino pro micro and I am facing a peculiar problem. The project I am working with includes arduino MKR NB 1500 as well. I am transferring data from MKR NB 1500 to arduino pro micro through Serial1(Rx/Tx pins). I have added the sample code that i am using on both boards</p>
<p>program in arduino MKR NB 1500</p>
<pre><code>void setup() {
  Serial1.begin(9600);
}
void loop() {
  Serial1.print(&quot;printing&quot;);
  delay(2000);
}
</code></pre>
<p>program in pro micro</p>
<pre><code>#include &quot;Keyboard.h&quot;

void setup() {
  Serial1.begin(9600);
  Keyboard.begin();
}

void loop() {
  Keyboard.write(Serial1.read());
}
</code></pre>
<p>I would like to transfer some data from MKR NB 1500 to pro micro which emulates a keyboard and prints the data in a editor. I am powering the arduino MKR NB 1500 via USB using its native USB port. The pro micro works as expected when I connect both these boards to USB ports in the same laptop. (Output: printingprintingprintingprinting)</p>
<p>However, the pro micro prints garbage values when I connect the MKR NB 1500 to a USB port belonging to a different laptop. (Output: a10joh&lt;qqj&lt;zstjo)</p>
<p>Is there any reason for such a behavior. Please let me know if you need more information from my side or if i have not made myself clear.</p>
 37622: <p>You have to connect ground between the modules. Without common ground the logic level of signal can't be measured. While both boards were powered over USB from the same laptop the boards had common ground.</p>
<hr />
<p><code>read</code> returns -1 if nothing is available so check if some character was received:</p>
<pre><code>void loop() {
  if (Serial1.available()) {
    Keyboard.write(Serial1.read());
  }
}
</code></pre>
<p>btw: The MKR can emulate a keyboard too with the Keyboard library.</p>
