So I have an HC-05 module and want to use it as a second serial port on my Leonardo. I have my USB cable plugged in, and my goal is to write something on my pc, and see it on my phone. I am using the SoftwareSerial library to make pins 8 and 9 a serial port for the HC-05 which pairs with my phone.
#include <SoftwareSerial.h>
SoftwareSerial BTserial(8, 9); // RX | TX
const long baudRate = 38400;
char c=' ';
boolean NL = true;
void setup()
{
Serial.begin(9600);
}
void loop()
{
// Read from the Bluetooth module and send to the Arduino Serial Monitor
if (BTserial.available())
{
c = BTserial.read();
Serial.write(c);
}
// Read from the Serial Monitor and send to the Bluetooth module
if (Serial.available())
{
c = Serial.read();
BTserial.write(c);
// Echo the user input to the main window. The ">" character indicates the user entered text.
if (NL) { Serial.print(">"); NL = false; }
Serial.write(c);
if (c==10) { NL = true; }
}
}
I am using this app: "https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal"
Help! Thanks in advance