Im using arduino uno, i7 beacon. And i want to see the data of MAC and RSSI of beacon. I want to repeat the command "AT + DISI?" To search for beacons. but i can see only 70~71 words at once, so i can
t see MAC and RSSI.
send : AT+DISI?
recv : OK+DISISOK+DISC:00000000:00000000000000000000000000000000:0000000000:1103F154FE2B:-079OK+DISC:00000000:00000000000000000000000000000000:0000000000:AC233FA00508:-051OK+DISCE
is there anybody can help me?
#include <SoftwareSerial.h>
int bluetoothTx = 2;
int bluetoothRx = 3;
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
char recv_str[1000];
void setup()
{
Serial.begin(9600);
bluetooth.begin(9600);
}
void loop()
{
while(1)
{
sendBlueToothCommand("AT+DISI?");
delay(3000);
}
}
int sendBlueToothCommand(char command[])
{
Serial.print("send : ");
Serial.print(command);
Serial.println("");
bluetooth.print(command);
delay(300);
if(recvMsg(400) != 0) return -1;
Serial.print("recv : ");
Serial.print(recv_str);
Serial.println("");
return 0;
}
int recvMsg(unsigned int timeout)
{
unsigned int time = 0;
unsigned char num;
unsigned char i;
i = 0;
while(1)
{
delay(100);
if(bluetooth.available())
{
recv_str[i] = char(bluetooth.read());
i++;
break;
}
time++;
if(time> (timeout/50)) return -1;
}
while(bluetooth.available() && (i< 100))
{
recv_str[i] = char(bluetooth.read());
i++;
}
recv_str[i] = '\0';
return 0;
}