Weird respond while trying to test RSSI respond time

If you don't have much time, you can just read blue part :slight_smile:

I am trying to get RSSI value from HC05 and Arduino UNO for time, and I finally got RSSI :slight_smile:

But the case is, it is very hard to get,
(I plug off the Arduino, plug off 5 v pin, then plug on arduino, press the button on the HC05 while plugging in 5v pin again, and pull my hand from the button to get AT command mode; send at+init and at+inq commands[I have to press the button while sending at+ing code) to finally RSSI code :/)
I have this code and it is working

#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11);



char c = ' ';
boolean NL = true;


void setup() {
 Serial.begin(38400);
 BTSerial.begin(38400);
}

void loop()
{


  if (BTSerial.available())
  {
    c = BTSerial.read();
    Serial.write(c);
  }

  if (Serial.available())
  {
    c = Serial.read();
    BTSerial.write(c);

   if (NL) {
      Serial.print(">");
      NL = false;
    }
    Serial.write(c);
    if (c == 10) {
      NL = true;
    } 
  }
}

I need it automatic and continuous. So; firstly, I though that

#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11);



char c = ' ';
String command="at+init";
String command3="at+inqm=1,1,48";
String command2="at+inq";
boolean NL = true;


void setup() {
 Serial.begin(38400);
 BTSerial.begin(38400);

BTSerial.println(command);
 if (BTSerial.available())
  {
    c = BTSerial.read();
    Serial.write(c);
  }
BTSerial.println(command3);
 if (BTSerial.available())
  {
    c = BTSerial.read();
    Serial.write(c);


}
}
void loop()
{
  
BTSerial.println(command2);

  
  if (BTSerial.available())
  {
    c = BTSerial.read();
    Serial.write(c);
  }

 
  if (Serial.available())
  {
    c = Serial.read();
    BTSerial.write(c);

   
   if (NL) {
      Serial.print(">");
      NL = false;
    }
    Serial.write(c);
    if (c == 10) {
      NL = true;
    } 
  }
}

did not work :confused:

Then I though it might be because some timing case and that entering AT mode technique(Basically I though code works at wrong times)

So, I decided that maybe a system which would send at+inq command at every, for example, 30 seconds would work.

I though a parallel loop which works as a timer would do the job. After some googling, I learned double loop just does not work.

Then, I learned there is something called "timer". I checked it, but seemed a little complicated, so I looked trough reference to find something alternative.

I found millis() function and an example code. I planned to make a code which sends commands based on that function, like if(3000<millis()<4000) something...

But the case is, I don't know how much it takes to get one RSSI value. So I built an experiment code by inserting example code to my working one

#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11);

unsigned long time;

char c = ' ';
boolean NL = true;


void setup() {
 Serial.begin(38400);
 BTSerial.begin(38400);
}

void loop()
{


  if (BTSerial.available())
  {
    c = BTSerial.read();
    Serial.write(c);
       time = millis();
  //prints time since program started
  Serial.println(time);
  delay(500);
  }


  if (Serial.available())
  {
    c = Serial.read();
    BTSerial.write(c);


   if (NL) {
      Serial.print(">");
      NL = false;
    }
    Serial.write(c);
    if (c == 10) {
      NL = true;
    } 
  }

}

However, when I started with entering at+state? command, the respond is

And I have no idea what to do next :confused:

EDİT= Colours

you can just read yellow part

No, I can't. Only a dumbass would expect people to be able to read yellow on white.

And I have no idea what to do next

Stop with the anonymous printing. You have NO idea what you are printing. Is any given character part of the bluetooth output OR a digit from printing millis()'s output?

You have NO idea. So, don't print crap that way.

Barisbaris:
And I have no idea what to do next :confused:

The response to "at+state?" is:
STATE:INITIALIZED
OK
Is that not the response you were expecting?

PaulS:
No, I can't. Only a dumbass would expect people to be able to read yellow on white.
Stop with the anonymous printing. You have NO idea what you are printing. Is any given character part of the bluetooth output OR a digit from printing millis()'s output?

You have NO idea. So, don't print crap that way.

I fixed colours, thanks.

So, there is no way to manually find the problem while we are not sure which "Serial" does it?

Then, I will first stop getting Serial respond from the HC05 and test it again. :slight_smile:

johnwasser:
The response to "at+state?" is:
STATE:INITIALIZED
OK
Is that not the response you were expecting?

Actually I am trying to catch INITIALIZING to use at+inq command, and I actually reached it without the timer.

I am trying to get also a time value with incoming RSSI value to make sure about times.