I am trying to connect Bluetooth to my Arduino, I connected the hc-05 and downloaded app on my phone. The problem I am having is when I don't use the Serial.begin(9600) I can see the characters in my serial monitor when i use the app on my phone. But when I use Serial.begin(9600) I don't see the characters in my serial monitor. In both, the code still doesn't do what he meant to.
The code:
In a nutshell, You can either use BT or the Serial monitor, but not both at the same time.
You could use Software Serial to install the HC-05 on pin 2 and 3 for example and then Serial would remain available for debugging and uploading the code.
So I switched between my rx and tx and now when i send i get 3 sets of numbers
if i send a i get
97
13
10
if i send 1 i get:
49
13
10
I get the ascii of each thing but what are the 13 and 10 and how do i make it not as ascii
So final update I hope: I got it working i switched the rx and the tx so that rx is pin 3 and tx pin 2. and added in the code where it will make the ascii back to char.Thank you for the help
#include <SoftwareSerial.h>
SoftwareSerial MyBlue(2, 3); // RX | TX
int flag = 0;
int LED = 13;
char character;
void setup()
{
Serial.begin(9600);
MyBlue.begin(9600);
pinMode(LED, OUTPUT);
Serial.println("Ready to connect\nDefualt password is 1234 or 000");
}
void loop()
{
if (MyBlue.available()){
flag = MyBlue.read();
character = char(flag);
Serial.println(character);
}
if (character == '1')
{
digitalWrite(LED, HIGH);
}
else if (character == '0')
{
digitalWrite(LED, LOW);
}
}