I am attempting to just get the following URL every couple of minutes:
http://api.thingspeak.com/update.json?a ... ld1=<value from light sensor>
So most of the URL is the same but on each iteration I need to append the value from the light sensor. I have tried the URL with dummy data in my web browser and it does work.
What I can't fathom is how to convert the analog value from the sensor into a string that I can then append to the end of the URL.
Here is what that part of the code looks like in the void loop
Code: Select all
void loop()
{
int val = analogRead(sensePin);
String fieldValue = String(val);
Adafruit_CC3000_Client www = cc3000.connectTCP(ip, 80);
if (www.connected()) {
www.fastrprint(F("GET "));
www.fastrprint(F("/update.json?api_key=<my_api_key>&field1="));
www.fastrprint(fieldValue);
www.fastrprint(F(" HTTP/1.1\r\n"));
www.fastrprint(F("Host: ")); www.fastrprint(WEBSITE); www.fastrprint(F("\r\n"));
www.fastrprint(F("\r\n"));
www.println();
} else {
Serial.println(F("Connection failed"));
return;
}
Can anyone give me a clue please how to tag this value on to the end of the URL?