ThingSpeak Communication Library
Enables an Arduino, ESP8266, or Particle to write or read data to or from ThingSpeak™
|
Enables an Arduino, ESP8266, Particle or other compatible hardware to write or read data to or from ThingSpeak, an open data platform for the Internet of Things with MATLAB analytics and visualization. More...
Public Member Functions | |
bool | begin (Client &client, const char *customHostName, unsigned int port) |
Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak. More... | |
bool | begin (Client &client, IPAddress customIP, unsigned int port) |
Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak. More... | |
bool | begin (Client &client) |
Initializes the ThingSpeak library and network settings using the ThingSpeak.com service. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
int | writeField (unsigned long channelNumber, unsigned int field, String value, const char *writeAPIKey) |
Write a String to a single field in a ThingSpeak channel. More... | |
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 at once, call setField() for each of the fields you want to write, and then call writeFields() More... | |
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 at once, call setField() for each of the fields you want to write, and then call writeFields() More... | |
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 at once, call setField() for each of the fields you want to write, and then call writeFields() More... | |
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 at once, call setField() for each of the fields you want to write, and then call writeFields() More... | |
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 at once, call setField() for each of the fields you want to write, and then call writeFields() More... | |
int | setLatitude (float latitude) |
Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write, call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() More... | |
int | setLongitude (float longitude) |
Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write, call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() More... | |
int | setElevation (float elevation) |
Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write, call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() More... | |
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() More... | |
int | writeRaw (unsigned long channelNumber, const char *postMessage, const char *writeAPIKey) |
Write a raw POST to a ThingSpeak channel. More... | |
int | writeRaw (unsigned long channelNumber, String postMessage, const char *writeAPIKey) |
Write a raw POST to a ThingSpeak channel. More... | |
String | readStringField (unsigned long channelNumber, unsigned int field, const char *readAPIKey) |
Read the latest string from a private ThingSpeak channel. More... | |
String | readStringField (unsigned long channelNumber, unsigned int field) |
Read the latest string from a public ThingSpeak channel. More... | |
float | readFloatField (unsigned long channelNumber, unsigned int field, const char *readAPIKey) |
Read the latest float from a private ThingSpeak channel. More... | |
float | readFloatField (unsigned long channelNumber, unsigned int field) |
Read the latest float from a public ThingSpeak channel. More... | |
long | readLongField (unsigned long channelNumber, unsigned int field, const char *readAPIKey) |
Read the latest long from a private ThingSpeak channel. More... | |
long | readLongField (unsigned long channelNumber, unsigned int field) |
Read the latest long from a public ThingSpeak channel. More... | |
int | readIntField (unsigned long channelNumber, unsigned int field, const char *readAPIKey) |
Read the latest int from a private ThingSpeak channel. More... | |
int | readIntField (unsigned long channelNumber, unsigned int field) |
Read the latest int from a public ThingSpeak channel. More... | |
String | readRaw (unsigned long channelNumber, String URLSuffix) |
Read a raw response from a public ThingSpeak channel. More... | |
String | readRaw (unsigned long channelNumber, String URLSuffix, const char *readAPIKey) |
Read a raw response from a private ThingSpeak channel. More... | |
int | getLastReadStatus () |
Get the status of the previous read. More... | |
Enables an Arduino, ESP8266, Particle or other compatible hardware to write or read data to or from ThingSpeak, an open data platform for the Internet of Things with MATLAB analytics and visualization.
bool begin | ( | Client & | client, |
const char * | customHostName, | ||
unsigned int | port | ||
) |
Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak.
client | EthernetClient, YunClient, TCPClient, or WiFiClient created earlier in the sketch |
customHostName | Host name of a custom install of ThingSpeak |
port | Port number to use with a custom install of ThingSpeak |
bool begin | ( | Client & | client, |
IPAddress | customIP, | ||
unsigned int | port | ||
) |
Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak.
client | EthernetClient, YunClient, TCPClient, or WiFiClient created earlier in the sketch |
customIP | IP address of a custom install of ThingSpeak |
port | Port number to use with a custom install of ThingSpeak |
bool begin | ( | Client & | client | ) |
Initializes the ThingSpeak library and network settings using the ThingSpeak.com service.
client | EthernetClient, YunClient, TCPClient, or WiFiClient created earlier in the sketch |
int getLastReadStatus | ( | ) |
Get the status of the previous read.
float readFloatField | ( | unsigned long | channelNumber, |
unsigned int | field, | ||
const char * | readAPIKey | ||
) |
Read the latest float from a private ThingSpeak channel.
channelNumber | Channel number |
field | Field number (1-8) within the channel to read from. |
readAPIKey | Read API key associated with the channel. If you share code with others, do not share this key |
float readFloatField | ( | unsigned long | channelNumber, |
unsigned int | field | ||
) |
Read the latest float from a public ThingSpeak channel.
channelNumber | Channel number |
field | Field number (1-8) within the channel to read from. |
int readIntField | ( | unsigned long | channelNumber, |
unsigned int | field, | ||
const char * | readAPIKey | ||
) |
Read the latest int from a private ThingSpeak channel.
channelNumber | Channel number |
field | Field number (1-8) within the channel to read from. |
readAPIKey | Read API key associated with the channel. If you share code with others, do not share this key |
int readIntField | ( | unsigned long | channelNumber, |
unsigned int | field | ||
) |
Read the latest int from a public ThingSpeak channel.
channelNumber | Channel number |
field | Field number (1-8) within the channel to read from. |
long readLongField | ( | unsigned long | channelNumber, |
unsigned int | field, | ||
const char * | readAPIKey | ||
) |
Read the latest long from a private ThingSpeak channel.
channelNumber | Channel number |
field | Field number (1-8) within the channel to read from. |
readAPIKey | Read API key associated with the channel. If you share code with others, do not share this key |
long readLongField | ( | unsigned long | channelNumber, |
unsigned int | field | ||
) |
Read the latest long from a public ThingSpeak channel.
channelNumber | Channel number |
field | Field number (1-8) within the channel to read from. |
String readRaw | ( | unsigned long | channelNumber, |
String | URLSuffix | ||
) |
Read a raw response from a public ThingSpeak channel.
channelNumber | Channel number |
URLSuffix | Raw URL to write to ThingSpeak as a String. See the documentation at https://thingspeak.com/docs/channels#get_feed |
String readRaw | ( | unsigned long | channelNumber, |
String | URLSuffix, | ||
const char * | readAPIKey | ||
) |
Read a raw response from a private ThingSpeak channel.
channelNumber | Channel number |
URLSuffix | Raw URL to write to ThingSpeak as a String. See the documentation at https://thingspeak.com/docs/channels#get_feed |
readAPIKey | Read API key associated with the channel. If you share code with others, do not share this key |
String readStringField | ( | unsigned long | channelNumber, |
unsigned int | field, | ||
const char * | readAPIKey | ||
) |
Read the latest string from a private ThingSpeak channel.
channelNumber | Channel number |
field | Field number (1-8) within the channel to read from. |
readAPIKey | Read API key associated with the channel. If you share code with others, do not share this key |
String readStringField | ( | unsigned long | channelNumber, |
unsigned int | field | ||
) |
Read the latest string from a public ThingSpeak channel.
channelNumber | Channel number |
field | Field number (1-8) within the channel to read from. |
int setElevation | ( | float | elevation | ) |
Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write, call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields()
elevation | Elevation of the measurement (meters above sea level) |
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 at once, call setField() for each of the fields you want to write, and then call writeFields()
field | Field number (1-8) within the channel to set |
value | Integer value (from -32,768 to 32,767) to set. |
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 at once, call setField() for each of the fields you want to write, and then call writeFields()
field | Field number (1-8) within the channel to set |
value | Long value (from -2,147,483,648 to 2,147,483,647) to write. |
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 at once, call setField() for each of the fields you want to write, and then call writeFields()
field | Field number (1-8) within the channel to set |
value | Floating point value (from -999999000000 to 999999000000) to write. If you need more accuracy, or a wider range, you should format the number yourself (using dtostrf ) and setField() using the resulting string. |
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 at once, call setField() for each of the fields you want to write, and then call writeFields()
field | Field number (1-8) within the channel to set |
value | String to write (UTF8). ThingSpeak limits this to 255 bytes. |
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 at once, call setField() for each of the fields you want to write, and then call writeFields()
field | Field number (1-8) within the channel to set |
value | String to write (UTF8). ThingSpeak limits this to 255 bytes. |
int setLatitude | ( | float | latitude | ) |
Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write, call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields()
latitude | Latitude of the measurement (degrees N, use negative values for degrees S) |
int setLongitude | ( | float | longitude | ) |
Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write, call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields()
longitude | Longitude of the measurement (degrees E, use negative values for degrees W) |
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.
channelNumber | Channel number |
field | Field number (1-8) within the channel to write to. |
value | Integer value (from -32,768 to 32,767) to write. |
writeAPIKey | Write API key associated with the channel. If you share code with others, do not share this key |
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.
channelNumber | Channel number |
field | Field number (1-8) within the channel to write to. |
value | Long value (from -2,147,483,648 to 2,147,483,647) to write. |
writeAPIKey | Write API key associated with the channel. If you share code with others, do not share this key |
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.
channelNumber | Channel number |
field | Field number (1-8) within the channel to write to. |
value | Floating point value (from -999999000000 to 999999000000) to write. If you need more accuracy, or a wider range, you should format the number using dtostrf and writeField(). |
writeAPIKey | Write API key associated with the channel. If you share code with others, do not share this key |
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.
channelNumber | Channel number |
field | Field number (1-8) within the channel to write to. |
value | String to write (UTF8 string). ThingSpeak limits this field to 255 bytes. |
writeAPIKey | Write API key associated with the channel. If you share code with others, do not share this key |
int writeField | ( | unsigned long | channelNumber, |
unsigned int | field, | ||
String | value, | ||
const char * | writeAPIKey | ||
) |
Write a String to a single field in a ThingSpeak channel.
channelNumber | Channel number |
field | Field number (1-8) within the channel to write to. |
value | Character array (zero terminated) to write (UTF8). ThingSpeak limits this field to 255 bytes. |
writeAPIKey | Write API key associated with the channel. If you share code with others, do not share this key |
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()
channelNumber | Channel number |
writeAPIKey | Write API key associated with the channel. If you share code with others, do not share this key |
int writeRaw | ( | unsigned long | channelNumber, |
const char * | postMessage, | ||
const char * | writeAPIKey | ||
) |
Write a raw POST to a ThingSpeak channel.
channelNumber | Channel number |
postMessage | Raw URL to write to ThingSpeak as a string. See the documentation at https://thingspeak.com/docs/channels#update_feed. |
writeAPIKey | Write API key associated with the channel. If you share code with others, do not share this key |
int writeRaw | ( | unsigned long | channelNumber, |
String | postMessage, | ||
const char * | writeAPIKey | ||
) |
Write a raw POST to a ThingSpeak channel.
channelNumber | Channel number |
postMessage | Raw URL to write to ThingSpeak as a String. See the documentation at https://thingspeak.com/docs/channels#update_feed. |
writeAPIKey | Write API key associated with the channel. If you share code with others, do not share this key |
See the accompaning licence file for licensing information |
Copyright © 2016 The MathWorks, Inc. |