SIM800 module and a standard Arduino, I have a function to communicate by software serial with the module:

 String SIM800_send(String Incomming){
      SoftwareSerial SIM800(SIM800_TX_PIN,SIM800_RX_PIN); 
 String result = "";
   while (SIM800.available()) {
  char letter = SIM800.read();
   result = result +  String(letter);  

It appears to work fine in the serial monitor, and a simple "AT" command returns OK:

However I can not get this to work:

  String modreturn = SIM800_send("AT");


  if (modreturn == "OK"){
     Serial.print("Modem Comms OK");
    Serial.println("Modem Not Healthy");

In the serial monitor I am seeing an echo of AT and OK , it's beyond me why the comparison does't work, what am I doing wrong here?

Serial monitor shows:

-> AT
-> OK
-> Modem Not Healthy

My modem is always "Not Healthy" even though I can see the OK reply from the SIM800.

| improve this question | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.