#include <SoftwareSerial.h>
SoftwareSerial bluetooth(14, 12);
int cnt = 0;
int started = 0;
int ind = 0;
const char endTag[] = "DISCE";
void setup()
{d
bluetooth.begin(115200);
Serial.begin(115200);
}
void loop()
{
if (started == 0)
{
bluetooth.print("AT+DISI?");
started = 1;
}
if (started ==1 && bluetooth.available())
{
char charIn = bluetooth.read();
Serial.print(charIn);
// look for the endTag while we are processing
if (charIn == endTag[ind])
{
ind++;
}
else
{
ind = 0;
}
// have we found the endTag?
if (ind == 5)
{
Serial.println("*"); //line end
started = 0;
ind = 0;
}
}