How to upload two string in a single field (thingspeak)

Hello,

I am uploading sensor values on thingspeak server and I am able to upload two string in two different field by using :

String str="GET https://api.thingspeak.com/update?api_key=xxxxxxxxxxxxxx&field1=0" + String(temp)+"&field2=" +String(temp2);

How to upload two string in a single field, can anyone help?

How to upload two string in a single field, can anyone help?

So, you want “Blueberry pancakes” and " with maple syrup" in one field? Just exactly how is THAT going to be useful?

   String pissAwayResources = "Blueberry pancakes" + " with maple syrup";
   String str="GET https://api.thingspeak.com/update?api_key=xxxxxxxxxxxxxx&uselessBlather=" + pissAwayResources + "\"";

Hello PaulS,

I tried this :

String pissAwayResources = "Blueberry pancakes" + " with maple syrup";

String str="GET https://api.thingspeak.com/update?api_key=xxxxxxxxxxxxxx&uselessBlather=" + pissAwayResources + "\"";

But, I am getting the addition of both.

But, I am getting the addition of both.

Of both what? Post your code, and something to explain what you are talking about.

I am getting the addition of temperature sensor 1 and 2 by using this :

String pissAwayResources = “Blueberry pancakes” + " with maple syrup";

String str=“GET https://api.thingspeak.com/update?api_key=xxxxxxxxxxxxxx&uselessBlather=” + pissAwayResources + “”";

==============================================
Here is my actual code

#include <SoftwareSerial.h>
#include <String.h>

SoftwareSerial mySerial(10, 11);

boolean pin2=LOW,pin3=LOW,pin4=LOW,pin5=LOW,pin6=LOW;
float temp=0.0;
float temp2=0.0;

void setup()
{
mySerial.begin(9600); // the GPRS baud rate
Serial.begin(9600); // the GPRS baud rate
pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(4,INPUT);
pinMode(5,INPUT);
pinMode(6,INPUT);
delay(1000);
}

void loop()
{
temp=analogRead(A0);
temp=temp*0.4887;

temp2=analogRead(A1);
temp=temp*0.4887;
delay(2);
Send2Pachube();

if (mySerial.available())
Serial.write(mySerial.read());
}
void Send2Pachube()
{
mySerial.println(“AT”);
delay(1000);

mySerial.println(“AT+CPIN?”);
delay(1000);

mySerial.println(“AT+CREG?”);
delay(1000);

mySerial.println(“AT+CGATT?”);
delay(1000);

mySerial.println(“AT+CIPSHUT”);
delay(1000);

mySerial.println(“AT+CIPSTATUS”);
delay(2000);

mySerial.println(“AT+CIPMUX=0”);
delay(2000);

ShowSerialData();

mySerial.println(“AT+CSTT=“www””);//start task and setting the APN,
delay(1000);

ShowSerialData();

mySerial.println(“AT+CIICR”);//bring up wireless connection
delay(3000);

ShowSerialData();

mySerial.println(“AT+CIFSR”);//get local IP adress
delay(2000);

ShowSerialData();

mySerial.println(“AT+CIPSPRT=0”);
delay(3000);

ShowSerialData();

mySerial.println("AT+CIPSTART=“TCP”,“api.thingspeak.com”,“80"”);//start up the connection
delay(6000);

ShowSerialData();

mySerial.println(“AT+CIPSEND”);//begin send data to remote server
delay(4000);
ShowSerialData();

//NEED HELP HERE

String str=“GET https://api.thingspeak.com/update?api_key=1GBXZTJPBIBJEUAO&field1=” + String(temp)+"&field2=" +String(temp2);
mySerial.println(str);//begin send data to remote server
delay(4000);
ShowSerialData();

mySerial.println((char)26);//sending
delay(5000);//waitting for reply, important! the time is base on the condition of internet
mySerial.println();

ShowSerialData();

mySerial.println(“AT+CIPSHUT”);//close the connection
delay(100);
ShowSerialData();
}
void ShowSerialData()
{
while(mySerial.available()!=0)
Serial.write(mySerial.read());
}

Hello PaulS,

Can you help?

MohdShanawaz: Hello PaulS,

Can you help?

With what? "NEED HELP HERE" is rather useless, without knowing what you need help with.

You might start with a CONCRETE example of the two strings that make sense in one field. The usual reason for sending data to thingsqueak is to visualize trends, like temperature of the course of a data. Sending text does not make sense.

Typically, you use two fields, so you can visualize things like indoor and outdoor temperature, or temperature and humidity, in the same plot. Plotting text doesn't make sense.