Arduino GSM - Sending Message Issue

Hello,

I am using an Arduino MKR 1400 (https://store.arduino.cc/usa/mkr-gsm-1400).

My main goal is to put my sensor data in a string and send it to the hologram server.

I am trying to send messages to the Hologram server (I followed instructions here: https://help.hologram.io/en/articles/2235031-arduino-mkr-gsm-1400).

I am having issues

I am able to connect and send with this code (setup):

  // if you get a connection, report back via serial:
  if (client.connect(server, port)) {
    //Serial.println("Connected!");
    // Send a Message request:
    client.println("{\"k\":\"" + HOLOGRAM_DEVICE_KEY +"\",\"d\":\""+ HOLOGRAM_MESSAGE+ "\",\"t\":\""+HOLOGRAM_TOPIC+"\"}");
  } else {
    // if you didn't get a connection to the server:
    //Serial.println("connection failed");
  }

I can also send (only does it once) if I place the below code in the loop function.

client.println("{\"k\":\"" + HOLOGRAM_DEVICE_KEY +"\",\"d\":\""+ HOLOGRAM_MESSAGE+ "\",\"t\":\""+HOLOGRAM_TOPIC+"\"}");

My main goal is to put my sensor data in a string and send it to the hologram server.

Here is the output of the variable buf:

Basically its merging all the sensor data into variable “buf” and then setting “HOLOGRAM_MESSAGE” = to “buf” then sending it.

It is not working though. Any ideas why it is not working?

   //SEND DATA
   //***********************
  String buf;
  buf += F("OutsideH: ");
  buf += String(outsideH, 2);
  buf += F("% \nOutsideF: ");
  buf += String(outsideF, 2);
  buf += F("°F \nOutsideHIF: ");
  buf += String(outsideHIF, 2);
  buf += F("°F \nSoilM1: ");
  buf += String(soilM1, 0);
  buf += F("% \nSoilM2: ");
  buf += String(soilM2, 0);
  buf += F("% \nSoilF1: ");
  buf += String(soilF1, 2);
  buf += F("°F \nSoilF2: ");
  buf += String(soilF2, 2);
  buf += F("°F \nEND");
  //Serial.println(buf);
   //Serial.println();
  HOLOGRAM_MESSAGE = buf;
  client.println("{\"k\":\"" + HOLOGRAM_DEVICE_KEY +"\",\"d\":\""+ HOLOGRAM_MESSAGE+ "\",\"t\":\""+HOLOGRAM_TOPIC+"\"}");
  delay(15000);

Do you get any kind of a response back from the server?

Delete the degree symbol and try again. This was an issue for me.

Oh, probably a unicode issue. Not sure if that would be on our end or not. We’ll do a little testing there to see