Arduino GSM shield sending a string instead of a value

I’m combing two Arduino examples, SendSMS and GsmScanNetworks reading the data from the GsmScanNetworks and sending the values read to a mobile number.

Currently, this all works fine within the serial monitor giving me no trouble. However, the values I’m receiving via SMS provide the commands and not the values.

The code looks like this:

#include <GSM.h>

#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess;
GSM_SMS sms;
GSMScanner scannerNetworks;
GSMModem modemTest;

// Save data variables
String IMEI = "";

// serial monitor result messages
String errortext = "ERROR";

void setup()
{
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  Serial.println("Cellular Bonding Emulation");

  // connection state
  boolean notConnected = true;

  // Start GSM shield
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
  while (notConnected)
  {
    if (gsmAccess.begin(PINNUMBER) == GSM_READY)
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  // get modem parameters
  // IMEI, modem unique identifier
  Serial.print("Modem IMEI: ");
  IMEI = modemTest.getIMEI();
  IMEI.replace("\n", "");
  if (IMEI != NULL)
    Serial.println(IMEI);
  Serial.println("GSM initialized");

// scan for existing networks, displays a list of networks
  Serial.println("Scanning available networks. May take some seconds.");
  Serial.println(scannerNetworks.readNetworks());

  // currently connected carrier
  Serial.print("Current carrier: ");
  Serial.println(scannerNetworks.getCurrentCarrier());


}

void loop()

{

   // returns strength and ber
  // signal strength in 0-31 scale. 31 means power > 51dBm
  // BER is the Bit Error Rate. 0-7 scale. 99=not detectable
  Serial.print("Signal Strength: ");
  Serial.print(scannerNetworks.getSignalStrength());
  Serial.println(" (0-31)");
  
  // send the message
  sms.beginSMS("*************");
  sms.print("Current Carrier: ");
  sms.println(scannerNetworks.getCurrentCarrier());
  sms.print("Signal Strength: ");
  sms.print(scannerNetworks.getSignalStrength());
  sms.print(" (0-31)");
  sms.endSMS();
  Serial.println("\nCOMPLETE!\n");
  
}

The results of the SMS currently look like this:

"Current Carrier: AT+COPS?

Signal Strenght: AT+CSQ
(0-31)"

Please excuse any posting errors I’m new here.

TIA

ch310:
The results of the SMS currently look like this:

"Current Carrier: AT+COPS?

Signal Strenght: AT+CSQ
(0-31)"

I have no idea what that is suppose to tell us.

That is what your code is sending.

.

Hi ieee488,

Thanks for the speedy reply.

But why in the serial monitor can it provide values for the "Signal Strength" and "Current Carrier" and not via SMS?

Additionally, could you provide a solution to my problem?

TIA

looks like sms.println works differently than Serial.println

You'll have to figure out why

Thanks again I'll look into it.