Hi, i am developing a project that send data from sensor to web server through SIM800l GSM/GPRS module. I want to know how can I get AT command response and save it into a variable.
For example, I want to know the signal strenght using AT command "AT+CSQ". In serial monitor I can see the response, but i want to take that response and display in a screen or light on a red led if signal = 0 or green led if signal > 0.
The response of AT+CSQ command is: "+CSQ: 0,0" (I have no signal), so I want to light on a red LED in this case.
Portion of my code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(8, 9);
void setup(){
Serial.begin(9600);
mySerial.begin(9600);
delay(1000);
//with this, I can see response in serial monitor.
//I want to take the response into a String variable
mySerial.write("AT+CSQ\r");
}
void loop(){
if (mySerial.available()){
Serial.write(mySerial.read());
}
if (Serial.available()){
while(Serial.available()) {
mySerial.write(Serial.read());
}
mySerial.println();
}
}
Thank you very much.