user42979: I am currently working on a project with a HC-06 module. I hooked it up accordingly like so:
Arduino -> HC-06
5V -> VCC
GND -> GND
TX -> RX
RX -> TX

and I ran this code:
void setup() {
  Serial.begin(9600);
}

void loop() {
   Serial.print("test");
   Serial.print("\n");

}

Strangely enough that does not work at all. When I am using neither with or without PC as the power source. When I am using SoftwareSerial like this it works like a charm:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(0, 1); // RX, TX

void setup() {
  mySerial.begin(9600);
}

void loop() {

   mySerial.print("test");
   mySerial.print("\n");

}

Can someone please explain why and of course how to fix that?

user4143: You are using a Leonardo. Pins 0/1 aren't Serial, they're Serial1.  Serial is the built-in USB connection.
void setup() {
  Serial1.begin(9600);
}

void loop() {
   Serial1.print("test");
   Serial1.print("\n");

}


42979: <p>I am currently working on a project with a HC-06 module. I hooked it up accordingly like so:</p>

<pre><code>Arduino -&gt; HC-06
5V -&gt; VCC
GND -&gt; GND
TX -&gt; RX
RX -&gt; TX
</code></pre>

<p>and I ran this code:</p>

<pre><code>void setup() {
  Serial.begin(9600);
}

void loop() {
   Serial.print("test");
   Serial.print("\n");

}
</code></pre>

<p>Strangely enough that does not work at all. When I am using neither with or without PC as the power source. When I am using SoftwareSerial like this it works like a charm:</p>

<pre><code>#include &lt;SoftwareSerial.h&gt;
SoftwareSerial mySerial(0, 1); // RX, TX

void setup() {
  mySerial.begin(9600);
}

void loop() {

   mySerial.print("test");
   mySerial.print("\n");

}
</code></pre>

<p>Can someone please explain why and of course how to fix that?</p>
 4143: <p>You are using a Leonardo. Pins 0/1 aren't <code>Serial</code>, they're <code>Serial1</code>.  <code>Serial</code> is the built-in USB connection.</p>

<pre><code>void setup() {
  Serial1.begin(9600);
}

void loop() {
   Serial1.print("test");
   Serial1.print("\n");

}
</code></pre>
