-3

My code:

void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);
}

void loop() {
  Serial1.write("AT+DTTX\n");
  delay(5000);
  while (Serial1.available()) {
    String txtMsg = Serial1.readString();
    Serial.println(txtMsg);
  }  
}

Serial monitor:

1

AT+DTTX OK

Radio Tx Done RadioTxDelayDone Radio Rx Done Len:2 RSSI:-93 SNR:33

2

AT+DTTX OK

Radio Tx Done RadioTxDelayDone Radio Rx Done Len:2 RSSI:-90 SNR:32

3 AT+DTTX OK

Radio Tx Done RadioTxDelayDone Radio Rx Done Len:2 RSSI:-92 SNR:22

How to get RSSI and SNR from Serial monitor?

I want results like:

1 RSSI:-93 SNR:33

2 RSSI:-90 SNR:32

3 RSSI:-92 SNR:22

XAB3
  • 32
  • 6
Link
  • 89
  • 2
  • 9

1 Answers1

1
  char *tmp = strstr (strtoparse, "RRSI");

Tmp points to it or is NULL.

Then you can do whatever you want with it. I assume the format you provided us. If it is not parsing may be quite complicated

0___________
  • 60,014
  • 4
  • 34
  • 74