Hello there..
I'm trying out my first Bluetooth controller with my arduino uno. So I bought the HC-05 and started testing it with android bluetooth RC apps.
I hooked up the VCC and GND, and TxD and RxD to pins I set using Software serial library.
Here is my code:
#include<SoftwareSerial.h>
#define RxD 10
#define TxD 11
SoftwareSerial BT(RxD,TxD);
void setup()
{
Serial.begin(9600);
pinMode(RxD,INPUT);
pinMode(TxD,OUTPUT);
pinMode(13,OUTPUT);
setupBT();
}
void loop()
{
int x;
if(BT.available()>0)
{x=BT.read();
Serial.println(x);}
if(x==1) digitalWrite(13,HIGH);
else digitalWrite(13,LOW);
}
void setupBT()
{
BT.begin(9600);
BT.print("\r\n+STWMOD=0\r\n");
BT.print("\r\n+STNA=HC-05\r\n");
BT.print("\r\n+STOAUT=1\r\n");
BT.print("\r\n+STAUTO=0\r\n");
delay(1000);
BT.flush();
}
Is my code correct? Or is it a problem with my module or uno? Because the serial monitor is not showing the sent data neither is the led glowing.. i have tried two android apps but it doesnt respond to commands from both.
Thank you for your time and advice.