I am trying to upload data to thingspeak cloud but it was not uploading to cloud

here is the code...it has no errors but not uploading to cloud..plz give me solution..

#include <SoftwareSerial.h>
SoftwareSerial espSerial = SoftwareSerial(2,3); // arduino RX pin=2 arduino TX pin=3 connect the arduino RX pin to esp8266 module TX pin - connect the arduino TX pin to esp8266 module RX pin

#include <Wire.h>

String apiKey = "WJM0D6EDXW9KMPUL"; // replace with your channel's thingspeak WRITE API key
// Your Wi-Fi credentials.
// Set password to "" for open networks.
char ssid[] = "sravi";
char pass[] = "gunna000";
boolean DEBUG=true;
// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200

//======================================================================== showResponce
void showResponse(int waitTime){
long t=millis();
char c;

while (t+waitTime>millis()){

if (espSerial.available()){
c=espSerial.read();
if (DEBUG) Serial.print(c);
}
}

}
//========================================================================
boolean thingSpeakWrite(float temp){
String cmd = "AT+CIPSTART="TCP",""; // TCP connection
cmd += "184.106.153.149"; // api.thingspeak.com
cmd += "",80";
espSerial.println(cmd);
if (DEBUG) Serial.println(cmd);
if(espSerial.find("Error")){
if (DEBUG) Serial.println("AT+CIPSTART error");

return false;
}

String getStr = "GET /update?api_key="; // prepare GET string
getStr += apiKey;
getStr +="&field1=";
getStr += String(temp);
// ...
getStr += "\r\n\r\n";

// send data length
cmd = "AT+CIPSEND=";
cmd += String(getStr.length());
espSerial.println(cmd);
if (DEBUG)Serial.println(cmd);

delay(100);

if(espSerial.find(">")){

espSerial.print(getStr);
if (DEBUG)Serial.print(getStr);
}
else{
espSerial.println("AT+CIPCLOSE");
// alert user
if (DEBUG)Serial.println("AT+CIPCLOSE");
return false;
}
return true;
}

void setup() {

// put your setup code here, to run once:
DEBUG=true;
Serial.begin(115200);
//esp8266.begin(115200);
espSerial.begin(ESP8266_BAUD);
delay(10);
espSerial.println("AT+CWMODE=1"); // set esp8266 as client
showResponse(1000);
if (DEBUG)Serial.println("Setup completed");

}

void loop() {
float temp = analogRead(A0);
temp = (temp/1024.0)*5000;
temp = temp/10;
//Serial.print("TEMPERATURE");
// Serial.print(temp);
//Serial.print("*C");
Serial.println();
delay(1000);

if (isnan(temp)) {
if (DEBUG) Serial.println("Failed to read from SENSORS");
}
else {

if (DEBUG)Serial.println("TEMPERATURE="+String(temp)+"*C");
thingSpeakWrite(temp); // Write values to thingspeak
}
//thingspeak needs 15 sec delay between updates,
}

Please do this:

  • When you encounter an error, you'll see a button on the right side of the orange bar "Copy error messages" in the Arduino IDE (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button..
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum's code tags markup to your reply.
  • Press "Ctrl + V". This will paste the error between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.

If the text exceeds the forum's 9000 character limit, save it to a .txt file and post it as an attachment. If you click the "Reply" button here, you will see an "Attachments and other settings" link.

gunna:
it has no errors but not uploading to cloud

OK, I think I understand now. So you're saying that you can upload the program to your board but then that the program is not able to write the data to Thingspeak. Is that correct?

gunna:

  //thingspeak needs 15 sec delay between updates,     

}

...yet you only provide a 1 second delay. It may be that Thingspeak is rejecting your attempts to write data because you're violating their rate limiting rules.

No it's not a problem..it can accept that delay and writes data into the site...But,here something else i am missing or doing wrong!!