Hi All,
I'm trying for a long time to get the CALL function working to make it possible to connect two ArduinoBT modules.
The Call function is working between PC and one ArduinoBT. For a strange reason I need to change ports when I call from the Arduino to the PC.
The problem is that I still don't get the connection between the ArduinoBT's working. I use this code to connect to an arduinoBT module.
void callF(){
if(fO == 0){
for(int g=0; g<7; g++){
if(kBTn[g][1] == 1 && kBTn[g][2] == 2){
inS.clear();
fO = 2;
outP(2, 500, 500, motor);
outP(2, 500, 500, statusLED);
Serial.print("+++");
outP(4, 500, 500, statusLED);
Serial.print("CALL ");
Serial.print(kBTa[g]);
Serial.print(" 1 RFCOMM");
Serial.println("");
outP(1, 10000, 0, statusLED);
outP(2, 500, 500, statusLED);
Serial.print("+++");
outP(4, 500, 500, statusLED);
getSt(); // get the complete serial buuffer into the sting inS
Serial.println(inS.getArray()); // prints the string inS
}
}
}
inS.clear();
}
This code I use to connect from an ArduinoBT module to my PC.
void callM(){
outP(2, 500, 500, statusLED);
Serial.print("+++");
outP(4, 500, 500, statusLED);
outP(1, 10000, 0, statusLED);
Serial.println("CLOSE 0");
outP(1, 10000, 0, statusLED);
Serial.println("CALL 00:16:41:ca:80:d9 1 RFCOMM");
//Serial.println("");
outP(1, 10000, 0, statusLED);
outP(2, 500, 500, statusLED);
Serial.print("+++");
outP(4, 500, 500, statusLED);
getSt(); // get the complete serial buuffer into the sting inS
Serial.println(inS.getArray()); // prints the string inS
Serial.println("*");
}
void outP(int t, int on, int of, int p){
for(int i=0; i <= t; i++){
digitalWrite(p, HIGH);
getSt();
if(fO == 0){
cFc();
coOs();
}
delay(on);
digitalWrite(p, LOW);
delay(of);
}
}
I hope that somebody can help me with this problem. When I get the call function working I will try write tutorial about this topic.
Thanks!