Hi, I'm Syahmeer. I have a problem here. I did the coding on arduino uno for tracking device by using bluetooth module cc41. The coding that I've been done as shown below is just to make a connection between bluetooth module and android smartphone.
#include <SoftwareSerial.h>
//RX AND TX PIN ASSIGNMENTS FOR THE ARDUINO uno ADK
int bluetoothTx = 2;
int bluetoothRx = 3;
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
void setup()
{
//Setup usb serial connection to computer
Serial.begin(9600);
//Setup Bluetooth serial connection to android
bluetooth.begin(115200);
bluetooth.print("$$$");
delay(100);
bluetooth.println("U,9600,N");
bluetooth.begin(9600);
}
void loop()
{
//Read from bluetooth and write to usb serial
if(bluetooth.available())
{
Serial.print((char)bluetooth.read());
}
//Read from usb serial to bluetooth
if(Serial.available())
{
bluetooth.print((char)Serial.read());
}
}
The bluetooth module are paired with the phone.
what is the coding to detect bluetooth module out of range (7 metre) from the phone? then what is the coding to send signal (alert) to the phone when the bluetooth module out of range (7 metre) from the phone ?
Thank you in advance for your help. This is urgent matter so I hope one of you can help me to settle down this problem.