I need help, I dont know what happens but everytime i try to send something from the bluetooth terminal on my phone to the arduino it does nothing even though is connected to my phone (because the bluetooth module stopped blinking)
#include <SoftwareSerial.h>
/*** Global variables ***/
SoftwareSerial blueToothSerial(4,2);
int Datos;
/*** Function declaration ***/
void setup()
{
pinMode(4,INPUT);
pinMode(2, OUTPUT);
blueToothSerial.begin(9600);
blueToothSerial.flush();
pinMode(12,OUTPUT);
}
void loop()
{
if (blueToothSerial.available()>0){
Datos=blueToothSerial.read();
}
if (Datos == 68) {
digitalWrite(13,HIGH);
}
if (Datos == 65) {
digitalWrite(13,LOW);
}
}
Joaco2799:
I need help, I dont know what happens but everytime i try to send something from the bluetooth terminal on my phone to the arduino it does nothing even though is connected to my phone
This only means what you say, and is no guarantee that Bluetooth is properly connected to Arduino. The phone doesn't know anything about that.
You might find the following background notes useful.
http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino
If the module TX/RX are properly connected to the Arduino RX/TX and you are sending 'D' and 'A' with a serial bluetooth terminal app your led will turn on and off. It does for me.
How is your module connected to the Arduino?
Typo here
//pinMode(12,OUTPUT);
pinMode(13,OUTPUT);
Your code would read more naturally using the control character instead of its ascii value.
if (Datos == 'D') {
digitalWrite(13,HIGH);
}
if (Datos == 'A') {
digitalWrite(13,LOW);
}
Thanks,hope u have a great day.
i think i get the problem i was connecting the bluetooth rx to arduino rx and the same with tx to arduino tx