57 #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM) 61 #error Only Arduino MKR1000, Yun, Uno/Mega/Due with either WiFi101 or Ethernet shield. ESP8266 also supported. 65 #define THINGSPEAK_URL "api.thingspeak.com" 66 #define THINGSPEAK_IPADDRESS IPAddress(184,106,153,149) 67 #define THINGSPEAK_PORT_NUMBER 80 69 #ifdef ARDUINO_ARCH_AVR 70 #ifdef ARDUINO_AVR_YUN 71 #define TS_USER_AGENT "tslib-arduino/1.0 (arduino yun)" 73 #define TS_USER_AGENT "tslib-arduino/1.0 (arduino uno or mega)" 75 #elif defined(ARDUINO_ARCH_ESP8266) 76 #define TS_USER_AGENT "tslib-arduino/1.0 (ESP8266)" 77 #elif defined(ARDUINO_SAMD_MKR1000) 78 #define TS_USER_AGENT "tslib-arduino/1.0 (arduino mkr1000)" 79 #elif defined(ARDUINO_SAM_DUE) 80 #define TS_USER_AGENT "tslib-arduino/1.0 (arduino due)" 81 #elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM) 82 #define TS_USER_AGENT "tslib-arduino/1.0 (arduino unknown sam or samd)" 84 #error "Platform not supported" 87 #define FIELDNUM_MIN 1 88 #define FIELDNUM_MAX 8 89 #define FIELDLENGTH_MAX 255 // Max length for a field in ThingSpeak is 255 bytes (UTF-8) 91 #define TIMEOUT_MS_SERVERRESPONSE 5000 // Wait up to five seconds for server to respond 93 #define OK_SUCCESS 200 // OK / Success 94 #define ERR_BADAPIKEY 400 // Incorrect API key (or invalid ThingSpeak server address) 95 #define ERR_BADURL 404 // Incorrect API key (or invalid ThingSpeak server address) 96 #define ERR_OUT_OF_RANGE -101 // Value is out of range or string is too long (> 255 bytes) 97 #define ERR_INVALID_FIELD_NUM -201 // Invalid field number specified 98 #define ERR_SETFIELD_NOT_CALLED -210 // setField() was not called before writeFields() 99 #define ERR_CONNECT_FAILED -301 // Failed to connect to ThingSpeak 100 #define ERR_UNEXPECTED_FAIL -302 // Unexpected failure during write to ThingSpeak 101 #define ERR_BAD_RESPONSE -303 // Unable to parse response 102 #define ERR_TIMEOUT -304 // Timeout waiting for server to respond 103 #define ERR_NOT_INSERTED -401 // Point was not inserted (most probable cause is the rate limit of once every 15 seconds) 114 this->lastReadStatus = OK_SUCCESS;
138 bool begin(Client & client,
const char * customHostName,
unsigned int port)
140 #ifdef PRINT_DEBUG_MESSAGES 141 Serial.print(
"ts::tsBegin (client: Client URL: "); Serial.print(customHostName); Serial.println(
")");
143 this->setClient(&client);
144 this->setServer(customHostName, port);
146 this->lastReadStatus = OK_SUCCESS;
171 bool begin(Client & client, IPAddress customIP,
unsigned int port)
173 #ifdef PRINT_DEBUG_MESSAGES 174 Serial.print(
"ts::tsBegin (client: Client IP: "); Serial.print(customIP); Serial.println(
")");
176 this->setClient(&client);
177 this->setServer(customIP, port);
179 this->lastReadStatus = OK_SUCCESS;
204 #ifdef PRINT_DEBUG_MESSAGES 205 Serial.print(
"ts::tsBegin");
207 this->setClient(&client);
210 this->lastReadStatus = OK_SUCCESS;
230 int writeField(
unsigned long channelNumber,
unsigned int field,
int value,
const char * writeAPIKey)
232 char valueString[10];
233 itoa(value, valueString, 10);
234 return writeField(channelNumber, field, valueString, writeAPIKey);
253 int writeField(
unsigned long channelNumber,
unsigned int field,
long value,
const char * writeAPIKey)
255 char valueString[15];
256 ltoa(value, valueString, 10);
257 return writeField(channelNumber, field, valueString, writeAPIKey);
277 int writeField(
unsigned long channelNumber,
unsigned int field,
float value,
const char * writeAPIKey)
279 #ifdef PRINT_DEBUG_MESSAGES 280 Serial.print(
"ts::writeField (channelNumber: "); Serial.print(channelNumber); Serial.print(
" writeAPIKey: "); Serial.print(writeAPIKey); Serial.print(
" field: "); Serial.print(field); Serial.print(
" value: "); Serial.print(value,5); Serial.println(
")");
282 char valueString[20];
283 int status = convertFloatToChar(value, valueString);
284 if(status != OK_SUCCESS)
return status;
286 return writeField(channelNumber, field, valueString, writeAPIKey);
310 int writeField(
unsigned long channelNumber,
unsigned int field,
const char * value,
const char * writeAPIKey)
312 return writeField(channelNumber, field, String(value), writeAPIKey);
339 int writeField(
unsigned long channelNumber,
unsigned int field, String value,
const char * writeAPIKey)
342 if(field < FIELDNUM_MIN || field > FIELDNUM_MAX)
return ERR_INVALID_FIELD_NUM;
344 if(value.length() > FIELDLENGTH_MAX)
return ERR_OUT_OF_RANGE;
346 #ifdef PRINT_DEBUG_MESSAGES 347 Serial.print(
"ts::writeField (channelNumber: "); Serial.print(channelNumber); Serial.print(
" writeAPIKey: "); Serial.print(writeAPIKey); Serial.print(
" field: "); Serial.print(field); Serial.print(
" value: \""); Serial.print(value); Serial.println(
"\")");
349 String postMessage = String(
"field") + String(field) +
"=" + value;
350 return writeRaw(channelNumber, postMessage, writeAPIKey);
388 char valueString[10];
389 itoa(value, valueString, 10);
391 return setField(field, valueString);
428 char valueString[15];
429 ltoa(value, valueString, 10);
430 return setField(field, valueString);
467 char valueString[20];
468 int status = convertFloatToChar(value, valueString);
469 if(status != OK_SUCCESS)
return status;
471 return setField(field, valueString);
505 int setField(
unsigned int field,
const char * value)
507 return setField(field, String(value));
543 #ifdef PRINT_DEBUG_MESSAGES 544 Serial.print(
"ts::setField (field: "); Serial.print(field); Serial.print(
" value: \""); Serial.print(value); Serial.println(
"\")");
546 if(field < FIELDNUM_MIN || field > FIELDNUM_MAX)
return ERR_INVALID_FIELD_NUM;
548 if(value.length() > FIELDLENGTH_MAX)
return ERR_OUT_OF_RANGE;
549 this->nextWriteField[field - 1] = value;
589 #ifdef PRINT_DEBUG_MESSAGES 590 Serial.print(
"ts::setLatitude(latitude: "); Serial.print(latitude,3); Serial.println(
"\")");
592 this->nextWriteLatitude = latitude;
632 #ifdef PRINT_DEBUG_MESSAGES 633 Serial.print(
"ts::setLongitude(longitude: "); Serial.print(longitude,3); Serial.println(
"\")");
635 this->nextWriteLongitude = longitude;
675 #ifdef PRINT_DEBUG_MESSAGES 676 Serial.print(
"ts::setElevation(elevation: "); Serial.print(elevation,3); Serial.println(
"\")");
678 this->nextWriteElevation = elevation;
717 int writeFields(
unsigned long channelNumber,
const char * writeAPIKey)
719 String postMessage = String(
"");
720 bool fFirstItem =
true;
721 for(
size_t iField = 0; iField < 8; iField++)
723 if(this->nextWriteField[iField].length() > 0)
727 postMessage = postMessage + String(
"&");
729 postMessage = postMessage + String(
"field") + String(iField + 1) + String(
"=") + this->nextWriteField[iField];
731 this->nextWriteField[iField] =
"";
735 if(!isnan(nextWriteLatitude))
739 postMessage = postMessage + String(
"&");
741 postMessage = postMessage + String(
"lat=") + String(this->nextWriteLatitude);
743 this->nextWriteLatitude = NAN;
746 if(!isnan(this->nextWriteLongitude))
750 postMessage = postMessage + String(
"&");
752 postMessage = postMessage + String(
"long=") + String(this->nextWriteLongitude);
754 this->nextWriteLongitude = NAN;
758 if(!isnan(this->nextWriteElevation))
762 postMessage = postMessage + String(
"&");
764 postMessage = postMessage + String(
"elevation=") + String(this->nextWriteElevation);
766 this->nextWriteElevation = NAN;
772 return ERR_SETFIELD_NOT_CALLED;
775 return writeRaw(channelNumber, postMessage, writeAPIKey);
799 int writeRaw(
unsigned long channelNumber,
const char * postMessage,
const char * writeAPIKey)
801 return writeRaw(channelNumber, String(postMessage), writeAPIKey);
820 int writeRaw(
unsigned long channelNumber, String postMessage,
const char * writeAPIKey)
822 #ifdef PRINT_DEBUG_MESSAGES 823 Serial.print(
"ts::writeRaw (channelNumber: "); Serial.print(channelNumber); Serial.print(
" writeAPIKey: "); Serial.print(writeAPIKey); Serial.print(
" postMessage: \""); Serial.print(postMessage); Serial.println(
"\")");
826 if(!connectThingSpeak())
829 return ERR_CONNECT_FAILED;
832 postMessage = postMessage + String(
"&headers=false");
834 #ifdef PRINT_DEBUG_MESSAGES 835 Serial.print(
" POST \"");Serial.print(postMessage);Serial.println(
"\"");
838 postMessage = postMessage + String(
"\n");
841 if(!this->client->print(
"POST /update HTTP/1.1\n"))
return abortWriteRaw();
842 if(!writeHTTPHeader(writeAPIKey))
return abortWriteRaw();
843 if(!this->client->print(
"Content-Type: application/x-www-form-urlencoded\n"))
return abortWriteRaw();
844 if(!this->client->print(
"Content-Length: "))
return abortWriteRaw();
845 if(!this->client->print(postMessage.length()))
return abortWriteRaw();
846 if(!this->client->print(
"\n\n"))
return abortWriteRaw();
847 if(!this->client->print(postMessage))
return abortWriteRaw();
849 String entryIDText = String();
850 int status = getHTTPResponse(entryIDText);
851 if(status != OK_SUCCESS)
856 long entryID = entryIDText.toInt();
858 #ifdef PRINT_DEBUG_MESSAGES 859 Serial.print(
" Entry ID \"");Serial.print(entryIDText);Serial.print(
"\" (");Serial.print(entryID);Serial.println(
")");
864 #ifdef PRINT_DEBUG_MESSAGES 865 Serial.println(
"disconnected.");
870 status = ERR_NOT_INSERTED;
890 String
readStringField(
unsigned long channelNumber,
unsigned int field,
const char * readAPIKey)
892 if(field < FIELDNUM_MIN || field > FIELDNUM_MAX)
894 this->lastReadStatus = ERR_INVALID_FIELD_NUM;
897 #ifdef PRINT_DEBUG_MESSAGES 898 Serial.print(
"ts::readStringField(channelNumber: "); Serial.print(channelNumber);
899 if(NULL != readAPIKey)
901 Serial.print(
" readAPIKey: "); Serial.print(readAPIKey);
903 Serial.print(
" field: "); Serial.print(field); Serial.println(
")");
905 return readRaw(channelNumber, String(String(
"/fields/") + String(field) + String(
"/last")), readAPIKey);
945 float readFloatField(
unsigned long channelNumber,
unsigned int field,
const char * readAPIKey)
947 return convertStringToFloat(
readStringField(channelNumber, field, readAPIKey));
987 long readLongField(
unsigned long channelNumber,
unsigned int field,
const char * readAPIKey)
1030 int readIntField(
unsigned long channelNumber,
unsigned int field,
const char * readAPIKey)
1071 String
readRaw(
unsigned long channelNumber, String URLSuffix)
1073 return readRaw(channelNumber, URLSuffix, NULL);
1092 String
readRaw(
unsigned long channelNumber, String URLSuffix,
const char * readAPIKey)
1094 #ifdef PRINT_DEBUG_MESSAGES 1095 Serial.print(
"ts::readRaw (channelNumber: "); Serial.print(channelNumber);
1096 if(NULL != readAPIKey)
1098 Serial.print(
" readAPIKey: "); Serial.print(readAPIKey);
1100 Serial.print(
" URLSuffix: \""); Serial.print(URLSuffix); Serial.println(
"\")");
1103 if(!connectThingSpeak())
1105 this->lastReadStatus = ERR_CONNECT_FAILED;
1109 String URL = String(
"/channels/") + String(channelNumber) + URLSuffix;
1111 #ifdef PRINT_DEBUG_MESSAGES 1112 Serial.print(
" GET \"");Serial.print(URL);Serial.println(
"\"");
1116 if(!this->client->print(
"GET "))
return abortReadRaw();
1117 if(!this->client->print(URL))
return abortReadRaw();
1118 if(!this->client->print(
" HTTP/1.1\n"))
return abortReadRaw();
1119 if(!writeHTTPHeader(readAPIKey))
return abortReadRaw();
1120 if(!this->client->print(
"\n"))
return abortReadRaw();
1122 String content = String();
1123 int status = getHTTPResponse(content);
1125 this->lastReadStatus = status;
1128 #ifdef PRINT_DEBUG_MESSAGES 1129 if(status == OK_SUCCESS)
1131 Serial.print(
"Read: \""); Serial.print(content); Serial.println(
"\"");
1136 #ifdef PRINT_DEBUG_MESSAGES 1137 Serial.println(
"disconnected.");
1140 if(status != OK_SUCCESS)
1147 return String(
"") + content;
1185 return this->lastReadStatus;
1191 this->client->stop();
1192 return ERR_UNEXPECTED_FAIL;
1195 String abortReadRaw()
1197 this->client->stop();
1198 #ifdef PRINT_DEBUG_MESSAGES 1199 Serial.println(
"ReadRaw abort - disconnected.");
1201 this->lastReadStatus = ERR_UNEXPECTED_FAIL;
1205 void setServer(
const char * customHostName,
unsigned int port)
1207 #ifdef PRINT_DEBUG_MESSAGES 1208 Serial.print(
"ts::setServer (URL: \""); Serial.print(customHostName); Serial.println(
"\")");
1210 this->customIP = INADDR_NONE;
1211 this->customHostName = customHostName;
1215 void setServer(IPAddress customIP,
unsigned int port)
1217 #ifdef PRINT_DEBUG_MESSAGES 1218 Serial.print(
"ts::setServer (IP: \""); Serial.print(customIP); Serial.println(
"\")");
1220 this->customIP = customIP;
1221 this->customHostName = NULL;
1227 #ifdef PRINT_DEBUG_MESSAGES 1228 Serial.print(
"ts::setServer (default)");
1230 this->customIP = INADDR_NONE;
1231 this->customHostName = NULL;
1232 this->port = THINGSPEAK_PORT_NUMBER;
1235 void setClient(Client * client) {this->client = client;};
1237 Client * client = NULL;
1238 const char * customHostName = NULL;
1239 IPAddress customIP = INADDR_NONE;
1240 unsigned int port = THINGSPEAK_PORT_NUMBER;
1241 String nextWriteField[8];
1242 float nextWriteLatitude;
1243 float nextWriteLongitude;
1244 float nextWriteElevation;
1247 bool connectThingSpeak()
1249 bool connectSuccess =
false;
1250 if(this->customIP == INADDR_NONE && NULL == this->customHostName)
1252 #ifdef PRINT_DEBUG_MESSAGES 1253 Serial.print(
" Connect to default ThingSpeak URL...");
1255 connectSuccess = client->connect(THINGSPEAK_URL,THINGSPEAK_PORT_NUMBER);
1258 #ifdef PRINT_DEBUG_MESSAGES 1259 Serial.print(
"Failed. Try default IP...");
1261 connectSuccess = client->connect(THINGSPEAK_IPADDRESS,THINGSPEAK_PORT_NUMBER);
1266 if(!(this->customIP == INADDR_NONE))
1269 #ifdef PRINT_DEBUG_MESSAGES 1270 Serial.print(
" Connect to ");Serial.print(this->customIP);Serial.print(
"...");
1272 connectSuccess = client->connect(this->customIP,this->port);
1274 if(NULL != this->customHostName)
1277 #ifdef PRINT_DEBUG_MESSAGES 1278 Serial.print(
" Connect to ");Serial.print(this->customHostName);Serial.print(
" ...");
1280 connectSuccess = client->connect(customHostName,this->port);
1284 #ifdef PRINT_DEBUG_MESSAGES 1287 Serial.println(
"Success.");
1291 Serial.println(
"Failed.");
1294 return connectSuccess;
1297 bool writeHTTPHeader(
const char * APIKey)
1299 if(NULL != this->customHostName)
1301 if (!this->client->print(
"Host: "))
return false;
1302 if (!this->client->print(this->customHostName))
return false;
1303 if (!this->client->print(
"\n"))
return false;
1307 if (!this->client->print(
"Host: api.thingspeak.com\n"))
return false;
1309 if (!this->client->print(
"Connection: close\n"))
return false;
1310 if (!this->client->print(
"User-Agent: "))
return false;
1311 if (!this->client->print(TS_USER_AGENT))
return false;
1312 if (!this->client->print(
"\n"))
return false;
1315 if (!this->client->print(
"X-THINGSPEAKAPIKEY: "))
return false;
1316 if (!this->client->print(APIKey))
return false;
1317 if (!this->client->print(
"\n"))
return false;
1322 int getHTTPResponse(String & response)
1324 long startWaitForResponseAt = millis();
1325 while(client->available() == 0 && millis() - startWaitForResponseAt < TIMEOUT_MS_SERVERRESPONSE)
1329 if(client->available() == 0)
1334 if(!client->find(const_cast<char *>(
"HTTP/1.1")))
1337 Serial.println(
"ERROR: Didn't find HTTP/1.1");
1339 return ERR_BAD_RESPONSE;
1341 int status = client->parseInt();
1343 Serial.print(
"Got Status of ");Serial.println(status);
1345 if(status != OK_SUCCESS)
1350 if(!client->find(const_cast<char *>(
"\r\n")))
1353 Serial.println(
"ERROR: Didn't find end of status line");
1355 return ERR_BAD_RESPONSE;
1358 Serial.println(
"Found end of status line");
1361 if(!client->find(const_cast<char *>(
"\n\r\n")))
1364 Serial.println(
"ERROR: Didn't find end of header");
1366 return ERR_BAD_RESPONSE;
1369 Serial.println(
"Found end of header");
1372 String tempString = client->readStringUntil(
'\r');
1373 response = tempString;
1375 Serial.print(
"Response: \"");Serial.print(response);Serial.println(
"\"");
1380 int convertFloatToChar(
float value,
char *valueString)
1383 if(0 == isinf(value) && (value > 999999000000 || value < -999999000000))
1386 return ERR_OUT_OF_RANGE;
1390 #if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM) 1391 sprintf(valueString,
"%.5f", value);
1393 dtostrf(value,1,5, valueString);
1398 float convertStringToFloat(String value)
1401 float result = value.toFloat();
1402 if(1 == isinf(result) && *value.c_str() ==
'-')
1404 result = (float)-INFINITY;
1409 void resetWriteFields()
1411 for(
size_t iField = 0; iField < 8; iField++)
1413 this->nextWriteField[iField] =
"";
1415 this->nextWriteLatitude = NAN;
1416 this->nextWriteLongitude = NAN;
1417 this->nextWriteElevation = NAN;
1423 #endif //ThingSpeak_h int writeRaw(unsigned long channelNumber, const char *postMessage, const char *writeAPIKey)
Write a raw POST to a ThingSpeak channel.
Definition: ThingSpeak.h:799
String readStringField(unsigned long channelNumber, unsigned int field, const char *readAPIKey)
Read the latest string from a private ThingSpeak channel.
Definition: ThingSpeak.h:890
String readStringField(unsigned long channelNumber, unsigned int field)
Read the latest string from a public ThingSpeak channel.
Definition: ThingSpeak.h:923
int setField(unsigned int field, long value)
Set the value of a single field that will be part of a multi-field update. To write multiple fields a...
Definition: ThingSpeak.h:426
int writeRaw(unsigned long channelNumber, String postMessage, const char *writeAPIKey)
Write a raw POST to a ThingSpeak channel.
Definition: ThingSpeak.h:820
bool begin(Client &client, IPAddress customIP, unsigned int port)
Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak...
Definition: ThingSpeak.h:171
int writeFields(unsigned long channelNumber, const char *writeAPIKey)
Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields()
Definition: ThingSpeak.h:717
int setField(unsigned int field, int value)
Set the value of a single field that will be part of a multi-field update. To write multiple fields a...
Definition: ThingSpeak.h:385
int setLatitude(float latitude)
Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...
Definition: ThingSpeak.h:587
bool begin(Client &client, const char *customHostName, unsigned int port)
Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak...
Definition: ThingSpeak.h:138
int getLastReadStatus()
Get the status of the previous read.
Definition: ThingSpeak.h:1183
int writeField(unsigned long channelNumber, unsigned int field, int value, const char *writeAPIKey)
Write an integer value to a single field in a ThingSpeak channel.
Definition: ThingSpeak.h:230
Enables an Arduino, ESP8266, Particle or other compatible hardware to write or read data to or from T...
Definition: ThingSpeak.h:108
long readLongField(unsigned long channelNumber, unsigned int field, const char *readAPIKey)
Read the latest long from a private ThingSpeak channel.
Definition: ThingSpeak.h:987
int writeField(unsigned long channelNumber, unsigned int field, String value, const char *writeAPIKey)
Write a String to a single field in a ThingSpeak channel.
Definition: ThingSpeak.h:339
int setField(unsigned int field, const char *value)
Set the value of a single field that will be part of a multi-field update. To write multiple fields a...
Definition: ThingSpeak.h:505
String readRaw(unsigned long channelNumber, String URLSuffix)
Read a raw response from a public ThingSpeak channel.
Definition: ThingSpeak.h:1071
long readLongField(unsigned long channelNumber, unsigned int field)
Read the latest long from a public ThingSpeak channel.
Definition: ThingSpeak.h:1008
int writeField(unsigned long channelNumber, unsigned int field, float value, const char *writeAPIKey)
Write a floating point value to a single field in a ThingSpeak channel.
Definition: ThingSpeak.h:277
int readIntField(unsigned long channelNumber, unsigned int field, const char *readAPIKey)
Read the latest int from a private ThingSpeak channel.
Definition: ThingSpeak.h:1030
int setField(unsigned int field, String value)
Set the value of a single field that will be part of a multi-field update. To write multiple fields a...
Definition: ThingSpeak.h:541
int setLongitude(float longitude)
Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...
Definition: ThingSpeak.h:630
float readFloatField(unsigned long channelNumber, unsigned int field, const char *readAPIKey)
Read the latest float from a private ThingSpeak channel.
Definition: ThingSpeak.h:945
bool begin(Client &client)
Initializes the ThingSpeak library and network settings using the ThingSpeak.com service.
Definition: ThingSpeak.h:202
float readFloatField(unsigned long channelNumber, unsigned int field)
Read the latest float from a public ThingSpeak channel.
Definition: ThingSpeak.h:966
int writeField(unsigned long channelNumber, unsigned int field, const char *value, const char *writeAPIKey)
Write a string to a single field in a ThingSpeak channel.
Definition: ThingSpeak.h:310
int readIntField(unsigned long channelNumber, unsigned int field)
Read the latest int from a public ThingSpeak channel.
Definition: ThingSpeak.h:1051
int setField(unsigned int field, float value)
Set the value of a single field that will be part of a multi-field update. To write multiple fields a...
Definition: ThingSpeak.h:465
String readRaw(unsigned long channelNumber, String URLSuffix, const char *readAPIKey)
Read a raw response from a private ThingSpeak channel.
Definition: ThingSpeak.h:1092
int setElevation(float elevation)
Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...
Definition: ThingSpeak.h:673
int writeField(unsigned long channelNumber, unsigned int field, long value, const char *writeAPIKey)
Write a long value to a single field in a ThingSpeak channel.
Definition: ThingSpeak.h:253