I want to upload rain sensor data to thingspeak using HTTP POST method, But while using "Api key= data to be sent .." The sensor data is not being uploaded to server.. and also as it is in quotes so it is not taking as function may be.... How to solve this problem??
Serial.print("api_key=QI8G7PVTC2BVIREC&field1=TellWater()\\r\\n");
You need to capture the return value of the
TellWater()in a variable.Here I am assuming
TellWater()return float. You need to convert it to string.After you convert the sensor data to string, you need to perform string concatenation to prepare final output string.
You should not escape back slash
\in\\r\\n. This will cause compiler to interpret the statement as character\(0x5c) and characterr(0x72) instead as\r(0x0D) (carriage-return). Similarly\\nwill be interpreted as character\(0x5c) and charactern(0x6e) instead as\n(0x0A) (line-feed) causing your GSM module to wait for data as it has not received line-ending characters (\r\n).