Arduino Leonardo RX TX mystery I'm at the tail end of a project using a Leonardo, a HC-06 bluetooth module and a few cell phone vibration motors.  Everything is working fine except the serial communication between the Leonardo and the HC-06.  I've done some tests to rule out common mistakes


TX is connected to RX, and vice versa.
Using a multimeter I checked for continuity with the RX TX, no problem there
I can upload the script
I uploaded the exact same script to an Uno, using the same HC-06.  I was able to connect to the HC-06 with my phone and execute the script.  So I know it's not the script and I know it's not the HC-06.
The Leonardo is working properly because I can upload the script and execute it using the Arduino Serial Monitor.


The only clue I have is that I can upload the script with the RX/TX connected and that's not supposed to work.  However, I checked the connections and there is continuity.  So I'm stumped.  The only thing I can think of is that I damaged the RX/TX while I was soldering, but I'm hoping it's not that.  Is there a way to test for that.  Any suggestions?

/*
 * created by Rui Santos, http://randomnerdtutorials.com
 * Bluetooth App - Turn On and Off LED
*/

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

int led = 3;
int state;

void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

void loop() {
  if(Serial.available() &gt; 0){     
      state = Serial.read();}

  if (state == '1') {
      digitalWrite(led, HIGH);}   // turn the LED on (HIGH is the voltage level)

  else if (state == '2') {
      digitalWrite(led, LOW);}    // turn the LED off by making the voltage LOW

  delay(100);               // wait for 100ms

  //For debugging purpose
  //Serial.println(state);
}
An Arduino Leonardo has native USB support. Which means that it has separate serial interfaces to the PC and to the hardware pins.

Serial is only used for the communication with the PC and is unrelated to the hardware serial pins 0 and 1. Those are exposed trough Serial1.

So, if you are using the exact same Uno sketch, that uses the hardware serial pins, it can't work on a Leonardo, because data is just sent-to/read-from the PC and not to the connected Bluetooth module connected on pins 0 an 1.