Quantcast
Channel: ThingSpeak IoT Community - Forum: Arduino
Viewing all articles
Browse latest Browse all 172

piajola on Upload two values to ThingSpeak with a Arduino GSM Module?

$
0
0

Hi ICar,

str is "string" the idea is concatenate one string from 2 strings plus 2 numbers. (convert the number to string)

It depends in the "type" of number int, float, etc.

My particular case is I have 2 numbers from my sensor

      float valHumidity;
      float valTemperature;

and thingspeak wants to receive one string that my "internet device" must compose. So my string is

    altSer.print(F("GET /update?api_key=")); // 20 chars
    altSer.print(apiKey);                            // 16 chars
    altSer.print(F("&field1="));                   // 8 chars
    altSer.print(String(valTemperature));      // 5 chars
    altSer.print(F("&field2="));                   // 8 chars
    altSer.print(String(valHumidity));            // 5 chars
    altSer.print(F("

"));                    // 4 chars

because also I must say how many characters I am sending. Capital F so arduino put the fixed strings in flash and use less RAM

      "&field1="+String(valTemperature))+"&field2="+String(valHumidity))

is the same string, but as I did is cleaner to see 2 years after to repeat

My device get the string and do whatever needed to send "really to Internet"

I do not know how to use your device but I think it is "more or less" the same thing

 

Hope still making sense Wink


Viewing all articles
Browse latest Browse all 172

Trending Articles