1 | <!-- ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
|
---|
2 | ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
|
---|
3 | systems that collect, analyze, and react to their environments.
|
---|
4 | Copyright 2016, The MathWorks, Inc.
|
---|
5 | See the accompaning licence file for licensing information.-->
|
---|
6 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
---|
7 | <html xmlns="http://www.w3.org/1999/xhtml">
|
---|
8 | <head>
|
---|
9 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
---|
10 | <meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
---|
11 | <meta name="generator" content="Doxygen 1.8.9.1"/>
|
---|
12 | <title>ThingSpeak Communication Library For Arduino, ESP8266, and Particle</title>
|
---|
13 | <link href="tabs.css" rel="stylesheet" type="text/css"/>
|
---|
14 | <script type="text/javascript" src="jquery.js"></script>
|
---|
15 | <script type="text/javascript" src="dynsections.js"></script>
|
---|
16 | <link href="doxygen.css" rel="stylesheet" type="text/css" />
|
---|
17 | </head>
|
---|
18 | <body>
|
---|
19 | <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
---|
20 | <div id="titlearea">
|
---|
21 | <table cellspacing="0" cellpadding="0" width="100%">
|
---|
22 | <tbody>
|
---|
23 | <tr style="height: 56px;">
|
---|
24 | <td style="padding-left: 0.5em;">
|
---|
25 | <div id="projectname">ThingSpeak Communication Library</div>
|
---|
26 | <div id="projectbrief">Enables an Arduino, ESP8266, or Particle to write or read data to or from ThingSpeak™</div>
|
---|
27 | </td>
|
---|
28 | <td valign="middle" align="right" id="projectlogo"><img alt="Logo" src="ThingSpeakLogo.jpg"/></td>
|
---|
29 | </tr>
|
---|
30 | </tbody>
|
---|
31 | </table>
|
---|
32 | </div>
|
---|
33 | <!-- end header part -->
|
---|
34 | <!-- Generated by Doxygen 1.8.9.1 -->
|
---|
35 | <div id="navrow1" class="tabs">
|
---|
36 | <ul class="tablist">
|
---|
37 | <li><a href="index.html"><span>Main Page</span></a></li>
|
---|
38 | <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
|
---|
39 | </ul>
|
---|
40 | </div>
|
---|
41 | <div id="navrow2" class="tabs2">
|
---|
42 | <ul class="tablist">
|
---|
43 | <li><a href="annotated.html"><span>Data Structures</span></a></li>
|
---|
44 | <li><a href="functions.html"><span>Data Fields</span></a></li>
|
---|
45 | </ul>
|
---|
46 | </div>
|
---|
47 | </div><!-- top -->
|
---|
48 | <div class="header">
|
---|
49 | <div class="summary">
|
---|
50 | <a href="#pub-methods">Public Member Functions</a> </div>
|
---|
51 | <div class="headertitle">
|
---|
52 | <div class="title">ThingSpeakClass Class Reference</div> </div>
|
---|
53 | </div><!--header-->
|
---|
54 | <div class="contents">
|
---|
55 |
|
---|
56 | <p>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.
|
---|
57 | <a href="class_thing_speak_class.html#details">More...</a></p>
|
---|
58 | <table class="memberdecls">
|
---|
59 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
|
---|
60 | Public Member Functions</h2></td></tr>
|
---|
61 | <tr class="memitem:a7375bc37b4cbf132751439f5fcafd1ba"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a7375bc37b4cbf132751439f5fcafd1ba">begin</a> (Client &client, const char *customHostName, unsigned int port)</td></tr>
|
---|
62 | <tr class="memdesc:a7375bc37b4cbf132751439f5fcafd1ba"><td class="mdescLeft"> </td><td class="mdescRight">Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak. <a href="#a7375bc37b4cbf132751439f5fcafd1ba">More...</a><br /></td></tr>
|
---|
63 | <tr class="separator:a7375bc37b4cbf132751439f5fcafd1ba"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
64 | <tr class="memitem:a8bedb31c0f619bed57944aca13b423d7"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a8bedb31c0f619bed57944aca13b423d7">begin</a> (Client &client, IPAddress customIP, unsigned int port)</td></tr>
|
---|
65 | <tr class="memdesc:a8bedb31c0f619bed57944aca13b423d7"><td class="mdescLeft"> </td><td class="mdescRight">Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak. <a href="#a8bedb31c0f619bed57944aca13b423d7">More...</a><br /></td></tr>
|
---|
66 | <tr class="separator:a8bedb31c0f619bed57944aca13b423d7"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
67 | <tr class="memitem:a92475d44f08bd87c798cff2e60491332"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a92475d44f08bd87c798cff2e60491332">begin</a> (Client &client)</td></tr>
|
---|
68 | <tr class="memdesc:a92475d44f08bd87c798cff2e60491332"><td class="mdescLeft"> </td><td class="mdescRight">Initializes the ThingSpeak library and network settings using the ThingSpeak.com service. <a href="#a92475d44f08bd87c798cff2e60491332">More...</a><br /></td></tr>
|
---|
69 | <tr class="separator:a92475d44f08bd87c798cff2e60491332"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
70 | <tr class="memitem:a24fa89e20ef8b3314ad8270c1f81dd2d"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a> (unsigned long channelNumber, unsigned int field, int value, const char *writeAPIKey)</td></tr>
|
---|
71 | <tr class="memdesc:a24fa89e20ef8b3314ad8270c1f81dd2d"><td class="mdescLeft"> </td><td class="mdescRight">Write an integer value to a single field in a ThingSpeak channel. <a href="#a24fa89e20ef8b3314ad8270c1f81dd2d">More...</a><br /></td></tr>
|
---|
72 | <tr class="separator:a24fa89e20ef8b3314ad8270c1f81dd2d"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
73 | <tr class="memitem:a3cc1f2fa986087cbc233a3f30d1dd957"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a3cc1f2fa986087cbc233a3f30d1dd957">writeField</a> (unsigned long channelNumber, unsigned int field, long value, const char *writeAPIKey)</td></tr>
|
---|
74 | <tr class="memdesc:a3cc1f2fa986087cbc233a3f30d1dd957"><td class="mdescLeft"> </td><td class="mdescRight">Write a long value to a single field in a ThingSpeak channel. <a href="#a3cc1f2fa986087cbc233a3f30d1dd957">More...</a><br /></td></tr>
|
---|
75 | <tr class="separator:a3cc1f2fa986087cbc233a3f30d1dd957"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
76 | <tr class="memitem:af41b9c173128a898ba83220f52fb93ba"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#af41b9c173128a898ba83220f52fb93ba">writeField</a> (unsigned long channelNumber, unsigned int field, float value, const char *writeAPIKey)</td></tr>
|
---|
77 | <tr class="memdesc:af41b9c173128a898ba83220f52fb93ba"><td class="mdescLeft"> </td><td class="mdescRight">Write a floating point value to a single field in a ThingSpeak channel. <a href="#af41b9c173128a898ba83220f52fb93ba">More...</a><br /></td></tr>
|
---|
78 | <tr class="separator:af41b9c173128a898ba83220f52fb93ba"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
79 | <tr class="memitem:a2e7a26e6bf7b65c0e8e53302787044e2"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a2e7a26e6bf7b65c0e8e53302787044e2">writeField</a> (unsigned long channelNumber, unsigned int field, const char *value, const char *writeAPIKey)</td></tr>
|
---|
80 | <tr class="memdesc:a2e7a26e6bf7b65c0e8e53302787044e2"><td class="mdescLeft"> </td><td class="mdescRight">Write a string to a single field in a ThingSpeak channel. <a href="#a2e7a26e6bf7b65c0e8e53302787044e2">More...</a><br /></td></tr>
|
---|
81 | <tr class="separator:a2e7a26e6bf7b65c0e8e53302787044e2"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
82 | <tr class="memitem:a91a8c326cb6a0b6fff38046cc90246ad"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a91a8c326cb6a0b6fff38046cc90246ad">writeField</a> (unsigned long channelNumber, unsigned int field, String value, const char *writeAPIKey)</td></tr>
|
---|
83 | <tr class="memdesc:a91a8c326cb6a0b6fff38046cc90246ad"><td class="mdescLeft"> </td><td class="mdescRight">Write a String to a single field in a ThingSpeak channel. <a href="#a91a8c326cb6a0b6fff38046cc90246ad">More...</a><br /></td></tr>
|
---|
84 | <tr class="separator:a91a8c326cb6a0b6fff38046cc90246ad"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
85 | <tr class="memitem:a72eea45043ab45051c02593983d29546"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a> (unsigned int field, int value)</td></tr>
|
---|
86 | <tr class="memdesc:a72eea45043ab45051c02593983d29546"><td class="mdescLeft"> </td><td class="mdescRight">Set the value of a single field that will be part of a multi-field update. To write multiple fields at once, call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <a href="#a72eea45043ab45051c02593983d29546">More...</a><br /></td></tr>
|
---|
87 | <tr class="separator:a72eea45043ab45051c02593983d29546"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
88 | <tr class="memitem:a8dba6e69d9cc12e5c5efe5043df02d81"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a8dba6e69d9cc12e5c5efe5043df02d81">setField</a> (unsigned int field, long value)</td></tr>
|
---|
89 | <tr class="memdesc:a8dba6e69d9cc12e5c5efe5043df02d81"><td class="mdescLeft"> </td><td class="mdescRight">Set the value of a single field that will be part of a multi-field update. To write multiple fields at once, call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <a href="#a8dba6e69d9cc12e5c5efe5043df02d81">More...</a><br /></td></tr>
|
---|
90 | <tr class="separator:a8dba6e69d9cc12e5c5efe5043df02d81"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
91 | <tr class="memitem:a5d3dfc59f211651ec7b1260e29921f45"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a5d3dfc59f211651ec7b1260e29921f45">setField</a> (unsigned int field, float value)</td></tr>
|
---|
92 | <tr class="memdesc:a5d3dfc59f211651ec7b1260e29921f45"><td class="mdescLeft"> </td><td class="mdescRight">Set the value of a single field that will be part of a multi-field update. To write multiple fields at once, call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <a href="#a5d3dfc59f211651ec7b1260e29921f45">More...</a><br /></td></tr>
|
---|
93 | <tr class="separator:a5d3dfc59f211651ec7b1260e29921f45"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
94 | <tr class="memitem:a46b7090f54ed4381ff825118d50db1fd"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a46b7090f54ed4381ff825118d50db1fd">setField</a> (unsigned int field, const char *value)</td></tr>
|
---|
95 | <tr class="memdesc:a46b7090f54ed4381ff825118d50db1fd"><td class="mdescLeft"> </td><td class="mdescRight">Set the value of a single field that will be part of a multi-field update. To write multiple fields at once, call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <a href="#a46b7090f54ed4381ff825118d50db1fd">More...</a><br /></td></tr>
|
---|
96 | <tr class="separator:a46b7090f54ed4381ff825118d50db1fd"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
97 | <tr class="memitem:a5201062087f349e50a3dda7e48312850"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a5201062087f349e50a3dda7e48312850">setField</a> (unsigned int field, String value)</td></tr>
|
---|
98 | <tr class="memdesc:a5201062087f349e50a3dda7e48312850"><td class="mdescLeft"> </td><td class="mdescRight">Set the value of a single field that will be part of a multi-field update. To write multiple fields at once, call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <a href="#a5201062087f349e50a3dda7e48312850">More...</a><br /></td></tr>
|
---|
99 | <tr class="separator:a5201062087f349e50a3dda7e48312850"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
100 | <tr class="memitem:ad790afb71eb19b723c6fc2f17f8f4400"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400">setLatitude</a> (float latitude)</td></tr>
|
---|
101 | <tr class="memdesc:ad790afb71eb19b723c6fc2f17f8f4400"><td class="mdescLeft"> </td><td class="mdescRight">Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write, call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, <a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400" title="Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLatitude()</a> / <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e" title="Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLongitude()</a> / <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9" title="Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...">setElevation()</a>, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <a href="#ad790afb71eb19b723c6fc2f17f8f4400">More...</a><br /></td></tr>
|
---|
102 | <tr class="separator:ad790afb71eb19b723c6fc2f17f8f4400"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
103 | <tr class="memitem:a8cb07c25c717a5acc5d8de60b19c0c3e"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e">setLongitude</a> (float longitude)</td></tr>
|
---|
104 | <tr class="memdesc:a8cb07c25c717a5acc5d8de60b19c0c3e"><td class="mdescLeft"> </td><td class="mdescRight">Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write, call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, <a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400" title="Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLatitude()</a> / <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e" title="Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLongitude()</a> / <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9" title="Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...">setElevation()</a>, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <a href="#a8cb07c25c717a5acc5d8de60b19c0c3e">More...</a><br /></td></tr>
|
---|
105 | <tr class="separator:a8cb07c25c717a5acc5d8de60b19c0c3e"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
106 | <tr class="memitem:a1e9cc3c21e0a7360310aba628ef586c9"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9">setElevation</a> (float elevation)</td></tr>
|
---|
107 | <tr class="memdesc:a1e9cc3c21e0a7360310aba628ef586c9"><td class="mdescLeft"> </td><td class="mdescRight">Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write, call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, <a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400" title="Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLatitude()</a> / <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e" title="Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLongitude()</a> / <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9" title="Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...">setElevation()</a>, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <a href="#a1e9cc3c21e0a7360310aba628ef586c9">More...</a><br /></td></tr>
|
---|
108 | <tr class="separator:a1e9cc3c21e0a7360310aba628ef586c9"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
109 | <tr class="memitem:a986d1958d5aa6705a53a31f3975f8cae"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a> (unsigned long channelNumber, const char *writeAPIKey)</td></tr>
|
---|
110 | <tr class="memdesc:a986d1958d5aa6705a53a31f3975f8cae"><td class="mdescLeft"> </td><td class="mdescRight">Write a multi-field update. Call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, <a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400" title="Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLatitude()</a> / <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e" title="Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLongitude()</a> / <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9" title="Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...">setElevation()</a>, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <a href="#a986d1958d5aa6705a53a31f3975f8cae">More...</a><br /></td></tr>
|
---|
111 | <tr class="separator:a986d1958d5aa6705a53a31f3975f8cae"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
112 | <tr class="memitem:a2a5333f683802cb455a3713d604abb84"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a2a5333f683802cb455a3713d604abb84">writeRaw</a> (unsigned long channelNumber, const char *postMessage, const char *writeAPIKey)</td></tr>
|
---|
113 | <tr class="memdesc:a2a5333f683802cb455a3713d604abb84"><td class="mdescLeft"> </td><td class="mdescRight">Write a raw POST to a ThingSpeak channel. <a href="#a2a5333f683802cb455a3713d604abb84">More...</a><br /></td></tr>
|
---|
114 | <tr class="separator:a2a5333f683802cb455a3713d604abb84"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
115 | <tr class="memitem:a7c3415bd86e0fa2c335d3b245912fb55"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a7c3415bd86e0fa2c335d3b245912fb55">writeRaw</a> (unsigned long channelNumber, String postMessage, const char *writeAPIKey)</td></tr>
|
---|
116 | <tr class="memdesc:a7c3415bd86e0fa2c335d3b245912fb55"><td class="mdescLeft"> </td><td class="mdescRight">Write a raw POST to a ThingSpeak channel. <a href="#a7c3415bd86e0fa2c335d3b245912fb55">More...</a><br /></td></tr>
|
---|
117 | <tr class="separator:a7c3415bd86e0fa2c335d3b245912fb55"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
118 | <tr class="memitem:aa1534ea566b7f9fc951a41f8cf41f53b"><td class="memItemLeft" align="right" valign="top">String </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#aa1534ea566b7f9fc951a41f8cf41f53b">readStringField</a> (unsigned long channelNumber, unsigned int field, const char *readAPIKey)</td></tr>
|
---|
119 | <tr class="memdesc:aa1534ea566b7f9fc951a41f8cf41f53b"><td class="mdescLeft"> </td><td class="mdescRight">Read the latest string from a private ThingSpeak channel. <a href="#aa1534ea566b7f9fc951a41f8cf41f53b">More...</a><br /></td></tr>
|
---|
120 | <tr class="separator:aa1534ea566b7f9fc951a41f8cf41f53b"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
121 | <tr class="memitem:a7ed5914c2f5c7d84672cdaae3547da96"><td class="memItemLeft" align="right" valign="top">String </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a7ed5914c2f5c7d84672cdaae3547da96">readStringField</a> (unsigned long channelNumber, unsigned int field)</td></tr>
|
---|
122 | <tr class="memdesc:a7ed5914c2f5c7d84672cdaae3547da96"><td class="mdescLeft"> </td><td class="mdescRight">Read the latest string from a public ThingSpeak channel. <a href="#a7ed5914c2f5c7d84672cdaae3547da96">More...</a><br /></td></tr>
|
---|
123 | <tr class="separator:a7ed5914c2f5c7d84672cdaae3547da96"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
124 | <tr class="memitem:a02cd79a65f1229711801fac5aec158b4"><td class="memItemLeft" align="right" valign="top">float </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a02cd79a65f1229711801fac5aec158b4">readFloatField</a> (unsigned long channelNumber, unsigned int field, const char *readAPIKey)</td></tr>
|
---|
125 | <tr class="memdesc:a02cd79a65f1229711801fac5aec158b4"><td class="mdescLeft"> </td><td class="mdescRight">Read the latest float from a private ThingSpeak channel. <a href="#a02cd79a65f1229711801fac5aec158b4">More...</a><br /></td></tr>
|
---|
126 | <tr class="separator:a02cd79a65f1229711801fac5aec158b4"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
127 | <tr class="memitem:ac65345864040b8f067a6d0e73a8dccfa"><td class="memItemLeft" align="right" valign="top">float </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#ac65345864040b8f067a6d0e73a8dccfa">readFloatField</a> (unsigned long channelNumber, unsigned int field)</td></tr>
|
---|
128 | <tr class="memdesc:ac65345864040b8f067a6d0e73a8dccfa"><td class="mdescLeft"> </td><td class="mdescRight">Read the latest float from a public ThingSpeak channel. <a href="#ac65345864040b8f067a6d0e73a8dccfa">More...</a><br /></td></tr>
|
---|
129 | <tr class="separator:ac65345864040b8f067a6d0e73a8dccfa"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
130 | <tr class="memitem:aff3c2e94e85da016fb8c82432e015d1b"><td class="memItemLeft" align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#aff3c2e94e85da016fb8c82432e015d1b">readLongField</a> (unsigned long channelNumber, unsigned int field, const char *readAPIKey)</td></tr>
|
---|
131 | <tr class="memdesc:aff3c2e94e85da016fb8c82432e015d1b"><td class="mdescLeft"> </td><td class="mdescRight">Read the latest long from a private ThingSpeak channel. <a href="#aff3c2e94e85da016fb8c82432e015d1b">More...</a><br /></td></tr>
|
---|
132 | <tr class="separator:aff3c2e94e85da016fb8c82432e015d1b"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
133 | <tr class="memitem:aa1660fbf6444ca06dc744a244905f6d9"><td class="memItemLeft" align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#aa1660fbf6444ca06dc744a244905f6d9">readLongField</a> (unsigned long channelNumber, unsigned int field)</td></tr>
|
---|
134 | <tr class="memdesc:aa1660fbf6444ca06dc744a244905f6d9"><td class="mdescLeft"> </td><td class="mdescRight">Read the latest long from a public ThingSpeak channel. <a href="#aa1660fbf6444ca06dc744a244905f6d9">More...</a><br /></td></tr>
|
---|
135 | <tr class="separator:aa1660fbf6444ca06dc744a244905f6d9"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
136 | <tr class="memitem:a1241ae5b3e08b1751495f2e45dabcc46"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a1241ae5b3e08b1751495f2e45dabcc46">readIntField</a> (unsigned long channelNumber, unsigned int field, const char *readAPIKey)</td></tr>
|
---|
137 | <tr class="memdesc:a1241ae5b3e08b1751495f2e45dabcc46"><td class="mdescLeft"> </td><td class="mdescRight">Read the latest int from a private ThingSpeak channel. <a href="#a1241ae5b3e08b1751495f2e45dabcc46">More...</a><br /></td></tr>
|
---|
138 | <tr class="separator:a1241ae5b3e08b1751495f2e45dabcc46"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
139 | <tr class="memitem:adb2ba704f38e591a6a391f7aa1850818"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#adb2ba704f38e591a6a391f7aa1850818">readIntField</a> (unsigned long channelNumber, unsigned int field)</td></tr>
|
---|
140 | <tr class="memdesc:adb2ba704f38e591a6a391f7aa1850818"><td class="mdescLeft"> </td><td class="mdescRight">Read the latest int from a public ThingSpeak channel. <a href="#adb2ba704f38e591a6a391f7aa1850818">More...</a><br /></td></tr>
|
---|
141 | <tr class="separator:adb2ba704f38e591a6a391f7aa1850818"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
142 | <tr class="memitem:a578758c62a821dc9197ec6a3fdc0f7bc"><td class="memItemLeft" align="right" valign="top">String </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a578758c62a821dc9197ec6a3fdc0f7bc">readRaw</a> (unsigned long channelNumber, String URLSuffix)</td></tr>
|
---|
143 | <tr class="memdesc:a578758c62a821dc9197ec6a3fdc0f7bc"><td class="mdescLeft"> </td><td class="mdescRight">Read a raw response from a public ThingSpeak channel. <a href="#a578758c62a821dc9197ec6a3fdc0f7bc">More...</a><br /></td></tr>
|
---|
144 | <tr class="separator:a578758c62a821dc9197ec6a3fdc0f7bc"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
145 | <tr class="memitem:abffced4cce37008c03c32d3feb38861d"><td class="memItemLeft" align="right" valign="top">String </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#abffced4cce37008c03c32d3feb38861d">readRaw</a> (unsigned long channelNumber, String URLSuffix, const char *readAPIKey)</td></tr>
|
---|
146 | <tr class="memdesc:abffced4cce37008c03c32d3feb38861d"><td class="mdescLeft"> </td><td class="mdescRight">Read a raw response from a private ThingSpeak channel. <a href="#abffced4cce37008c03c32d3feb38861d">More...</a><br /></td></tr>
|
---|
147 | <tr class="separator:abffced4cce37008c03c32d3feb38861d"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
148 | <tr class="memitem:a549941b4b0000a2ba89de94f038ed577"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577">getLastReadStatus</a> ()</td></tr>
|
---|
149 | <tr class="memdesc:a549941b4b0000a2ba89de94f038ed577"><td class="mdescLeft"> </td><td class="mdescRight">Get the status of the previous read. <a href="#a549941b4b0000a2ba89de94f038ed577">More...</a><br /></td></tr>
|
---|
150 | <tr class="separator:a549941b4b0000a2ba89de94f038ed577"><td class="memSeparator" colspan="2"> </td></tr>
|
---|
151 | </table>
|
---|
152 | <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
---|
153 | <div class="textblock"><p>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. </p>
|
---|
154 | </div><h2 class="groupheader">Member Function Documentation</h2>
|
---|
155 | <a class="anchor" id="a7375bc37b4cbf132751439f5fcafd1ba"></a>
|
---|
156 | <div class="memitem">
|
---|
157 | <div class="memproto">
|
---|
158 | <table class="memname">
|
---|
159 | <tr>
|
---|
160 | <td class="memname">bool begin </td>
|
---|
161 | <td>(</td>
|
---|
162 | <td class="paramtype">Client & </td>
|
---|
163 | <td class="paramname"><em>client</em>, </td>
|
---|
164 | </tr>
|
---|
165 | <tr>
|
---|
166 | <td class="paramkey"></td>
|
---|
167 | <td></td>
|
---|
168 | <td class="paramtype">const char * </td>
|
---|
169 | <td class="paramname"><em>customHostName</em>, </td>
|
---|
170 | </tr>
|
---|
171 | <tr>
|
---|
172 | <td class="paramkey"></td>
|
---|
173 | <td></td>
|
---|
174 | <td class="paramtype">unsigned int </td>
|
---|
175 | <td class="paramname"><em>port</em> </td>
|
---|
176 | </tr>
|
---|
177 | <tr>
|
---|
178 | <td></td>
|
---|
179 | <td>)</td>
|
---|
180 | <td></td><td></td>
|
---|
181 | </tr>
|
---|
182 | </table>
|
---|
183 | </div><div class="memdoc">
|
---|
184 |
|
---|
185 | <p>Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak. </p>
|
---|
186 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
187 | <table class="params">
|
---|
188 | <tr><td class="paramname">client</td><td>EthernetClient, YunClient, TCPClient, or WiFiClient created earlier in the sketch </td></tr>
|
---|
189 | <tr><td class="paramname">customHostName</td><td>Host name of a custom install of ThingSpeak </td></tr>
|
---|
190 | <tr><td class="paramname">port</td><td>Port number to use with a custom install of ThingSpeak </td></tr>
|
---|
191 | </table>
|
---|
192 | </dd>
|
---|
193 | </dl>
|
---|
194 | <dl class="section return"><dt>Returns</dt><dd>Always returns true This does not validate the information passed in, or generate any calls to ThingSpeak. <div class="fragment"><div class="line"><span class="preprocessor">#include <SPI.h></span></div>
|
---|
195 | <div class="line"><span class="preprocessor">#include <Ethernet.h></span></div>
|
---|
196 | <div class="line">byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};</div>
|
---|
197 | <div class="line">EthernetClient client;</div>
|
---|
198 | <div class="line"></div>
|
---|
199 | <div class="line"><span class="preprocessor">#include "ThingSpeak.h"</span></div>
|
---|
200 | <div class="line"></div>
|
---|
201 | <div class="line"><span class="keywordtype">void</span> setup() {</div>
|
---|
202 | <div class="line"> Ethernet.begin(mac);</div>
|
---|
203 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a7375bc37b4cbf132751439f5fcafd1ba">begin</a>(client,<span class="stringliteral">"api.thingspeak.com"</span>, 80);</div>
|
---|
204 | <div class="line">}</div>
|
---|
205 | </div><!-- fragment --> </dd></dl>
|
---|
206 |
|
---|
207 | </div>
|
---|
208 | </div>
|
---|
209 | <a class="anchor" id="a8bedb31c0f619bed57944aca13b423d7"></a>
|
---|
210 | <div class="memitem">
|
---|
211 | <div class="memproto">
|
---|
212 | <table class="memname">
|
---|
213 | <tr>
|
---|
214 | <td class="memname">bool begin </td>
|
---|
215 | <td>(</td>
|
---|
216 | <td class="paramtype">Client & </td>
|
---|
217 | <td class="paramname"><em>client</em>, </td>
|
---|
218 | </tr>
|
---|
219 | <tr>
|
---|
220 | <td class="paramkey"></td>
|
---|
221 | <td></td>
|
---|
222 | <td class="paramtype">IPAddress </td>
|
---|
223 | <td class="paramname"><em>customIP</em>, </td>
|
---|
224 | </tr>
|
---|
225 | <tr>
|
---|
226 | <td class="paramkey"></td>
|
---|
227 | <td></td>
|
---|
228 | <td class="paramtype">unsigned int </td>
|
---|
229 | <td class="paramname"><em>port</em> </td>
|
---|
230 | </tr>
|
---|
231 | <tr>
|
---|
232 | <td></td>
|
---|
233 | <td>)</td>
|
---|
234 | <td></td><td></td>
|
---|
235 | </tr>
|
---|
236 | </table>
|
---|
237 | </div><div class="memdoc">
|
---|
238 |
|
---|
239 | <p>Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak. </p>
|
---|
240 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
241 | <table class="params">
|
---|
242 | <tr><td class="paramname">client</td><td>EthernetClient, YunClient, TCPClient, or WiFiClient created earlier in the sketch </td></tr>
|
---|
243 | <tr><td class="paramname">customIP</td><td>IP address of a custom install of ThingSpeak </td></tr>
|
---|
244 | <tr><td class="paramname">port</td><td>Port number to use with a custom install of ThingSpeak </td></tr>
|
---|
245 | </table>
|
---|
246 | </dd>
|
---|
247 | </dl>
|
---|
248 | <dl class="section return"><dt>Returns</dt><dd>Always returns true This does not validate the information passed in, or generate any calls to ThingSpeak. <div class="fragment"><div class="line"><span class="preprocessor">#include <SPI.h></span></div>
|
---|
249 | <div class="line"><span class="preprocessor">#include <Ethernet.h></span></div>
|
---|
250 | <div class="line">byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};</div>
|
---|
251 | <div class="line">EthernetClient client;</div>
|
---|
252 | <div class="line"></div>
|
---|
253 | <div class="line"><span class="preprocessor">#include "ThingSpeak.h"</span></div>
|
---|
254 | <div class="line"></div>
|
---|
255 | <div class="line"><span class="keywordtype">void</span> setup() {</div>
|
---|
256 | <div class="line"> Ethernet.begin(mac);</div>
|
---|
257 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a7375bc37b4cbf132751439f5fcafd1ba">begin</a>(client,IPAddress(184,106,153,149), 80);</div>
|
---|
258 | <div class="line">}</div>
|
---|
259 | </div><!-- fragment --> </dd></dl>
|
---|
260 |
|
---|
261 | </div>
|
---|
262 | </div>
|
---|
263 | <a class="anchor" id="a92475d44f08bd87c798cff2e60491332"></a>
|
---|
264 | <div class="memitem">
|
---|
265 | <div class="memproto">
|
---|
266 | <table class="memname">
|
---|
267 | <tr>
|
---|
268 | <td class="memname">bool begin </td>
|
---|
269 | <td>(</td>
|
---|
270 | <td class="paramtype">Client & </td>
|
---|
271 | <td class="paramname"><em>client</em></td><td>)</td>
|
---|
272 | <td></td>
|
---|
273 | </tr>
|
---|
274 | </table>
|
---|
275 | </div><div class="memdoc">
|
---|
276 |
|
---|
277 | <p>Initializes the ThingSpeak library and network settings using the ThingSpeak.com service. </p>
|
---|
278 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
279 | <table class="params">
|
---|
280 | <tr><td class="paramname">client</td><td>EthernetClient, YunClient, TCPClient, or WiFiClient created earlier in the sketch </td></tr>
|
---|
281 | </table>
|
---|
282 | </dd>
|
---|
283 | </dl>
|
---|
284 | <dl class="section return"><dt>Returns</dt><dd>Always returns true This does not validate the information passed in, or generate any calls to ThingSpeak. <div class="fragment"><div class="line"><span class="preprocessor">#include <SPI.h></span></div>
|
---|
285 | <div class="line"><span class="preprocessor">#include <Ethernet.h></span></div>
|
---|
286 | <div class="line">byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};</div>
|
---|
287 | <div class="line">EthernetClient client;</div>
|
---|
288 | <div class="line"></div>
|
---|
289 | <div class="line"><span class="preprocessor">#include "ThingSpeak.h"</span></div>
|
---|
290 | <div class="line"></div>
|
---|
291 | <div class="line"><span class="keywordtype">void</span> setup() {</div>
|
---|
292 | <div class="line"> Ethernet.begin(mac);</div>
|
---|
293 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a7375bc37b4cbf132751439f5fcafd1ba">begin</a>(client);</div>
|
---|
294 | <div class="line">}</div>
|
---|
295 | </div><!-- fragment --> </dd></dl>
|
---|
296 |
|
---|
297 | </div>
|
---|
298 | </div>
|
---|
299 | <a class="anchor" id="a549941b4b0000a2ba89de94f038ed577"></a>
|
---|
300 | <div class="memitem">
|
---|
301 | <div class="memproto">
|
---|
302 | <table class="memname">
|
---|
303 | <tr>
|
---|
304 | <td class="memname">int getLastReadStatus </td>
|
---|
305 | <td>(</td>
|
---|
306 | <td class="paramname"></td><td>)</td>
|
---|
307 | <td></td>
|
---|
308 | </tr>
|
---|
309 | </table>
|
---|
310 | </div><div class="memdoc">
|
---|
311 |
|
---|
312 | <p>Get the status of the previous read. </p>
|
---|
313 | <dl class="section return"><dt>Returns</dt><dd>Generally, these are HTTP status codes. Negative values indicate an error generated by the library. Possible response codes:<ul>
|
---|
314 | <li>200: OK / Success</li>
|
---|
315 | <li>404: Incorrect API key (or invalid ThingSpeak server address)</li>
|
---|
316 | <li>-101: Value is out of range or string is too long (> 255 characters)</li>
|
---|
317 | <li>-201: Invalid field number specified</li>
|
---|
318 | <li>-210: <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> was not called before <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a></li>
|
---|
319 | <li>-301: Failed to connect to ThingSpeak</li>
|
---|
320 | <li>-302: Unexpected failure during write to ThingSpeak</li>
|
---|
321 | <li>-303: Unable to parse response</li>
|
---|
322 | <li>-304: Timeout waiting for server to respond</li>
|
---|
323 | <li>-401: Point was not inserted (most probable cause is the rate limit of once every 15 seconds) </li>
|
---|
324 | </ul>
|
---|
325 | </dd></dl>
|
---|
326 | <dl class="section remark"><dt>Remarks</dt><dd>The read functions will return zero or empty if there is an error. Use this function to retrieve the details. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
327 | <div class="line"> String message = ThingSpeak.<a class="code" href="class_thing_speak_class.html#aa1534ea566b7f9fc951a41f8cf41f53b">readStringField</a>(myChannelNumber, 1);</div>
|
---|
328 | <div class="line"> <span class="keywordtype">int</span> resultCode = ThingSpeak.<a class="code" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577">getLastReadStatus</a>();</div>
|
---|
329 | <div class="line"> <span class="keywordflow">if</span>(resultCode == 200)</div>
|
---|
330 | <div class="line"> {</div>
|
---|
331 | <div class="line"> Serial.print(<span class="stringliteral">"Latest message is: "</span>); </div>
|
---|
332 | <div class="line"> Serial.println(message);</div>
|
---|
333 | <div class="line"> }</div>
|
---|
334 | <div class="line"> <span class="keywordflow">else</span></div>
|
---|
335 | <div class="line"> {</div>
|
---|
336 | <div class="line"> Serial.print(<span class="stringliteral">"Error reading message. Status was: "</span>); </div>
|
---|
337 | <div class="line"> Serial.println(resultCode);</div>
|
---|
338 | <div class="line"> }</div>
|
---|
339 | <div class="line"> delay(30000);</div>
|
---|
340 | <div class="line">}</div>
|
---|
341 | </div><!-- fragment --> </dd></dl>
|
---|
342 |
|
---|
343 | </div>
|
---|
344 | </div>
|
---|
345 | <a class="anchor" id="a02cd79a65f1229711801fac5aec158b4"></a>
|
---|
346 | <div class="memitem">
|
---|
347 | <div class="memproto">
|
---|
348 | <table class="memname">
|
---|
349 | <tr>
|
---|
350 | <td class="memname">float readFloatField </td>
|
---|
351 | <td>(</td>
|
---|
352 | <td class="paramtype">unsigned long </td>
|
---|
353 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
354 | </tr>
|
---|
355 | <tr>
|
---|
356 | <td class="paramkey"></td>
|
---|
357 | <td></td>
|
---|
358 | <td class="paramtype">unsigned int </td>
|
---|
359 | <td class="paramname"><em>field</em>, </td>
|
---|
360 | </tr>
|
---|
361 | <tr>
|
---|
362 | <td class="paramkey"></td>
|
---|
363 | <td></td>
|
---|
364 | <td class="paramtype">const char * </td>
|
---|
365 | <td class="paramname"><em>readAPIKey</em> </td>
|
---|
366 | </tr>
|
---|
367 | <tr>
|
---|
368 | <td></td>
|
---|
369 | <td>)</td>
|
---|
370 | <td></td><td></td>
|
---|
371 | </tr>
|
---|
372 | </table>
|
---|
373 | </div><div class="memdoc">
|
---|
374 |
|
---|
375 | <p>Read the latest float from a private ThingSpeak channel. </p>
|
---|
376 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
377 | <table class="params">
|
---|
378 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
379 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to read from. </td></tr>
|
---|
380 | <tr><td class="paramname">readAPIKey</td><td>Read API key associated with the channel. <em>If you share code with others, do <em>not</em> share this key</em> </td></tr>
|
---|
381 | </table>
|
---|
382 | </dd>
|
---|
383 | </dl>
|
---|
384 | <dl class="section return"><dt>Returns</dt><dd>Value read, or 0 if the field is text or there is an error. Use <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> to get more specific information. Note that NAN, INFINITY, and -INFINITY are valid results. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
385 | <div class="line"> <span class="keywordtype">float</span> voltage = ThingSpeak.<a class="code" href="class_thing_speak_class.html#a02cd79a65f1229711801fac5aec158b4">readFloatField</a>(myChannelNumber, 1, myReadAPIKey);</div>
|
---|
386 | <div class="line"> Serial.print(<span class="stringliteral">"Latest voltage is: "</span>); </div>
|
---|
387 | <div class="line"> Serial.print(voltage);</div>
|
---|
388 | <div class="line"> Serial.println(<span class="stringliteral">"V"</span>); </div>
|
---|
389 | <div class="line"> delay(30000);</div>
|
---|
390 | <div class="line">}</div>
|
---|
391 | </div><!-- fragment --> </dd></dl>
|
---|
392 |
|
---|
393 | </div>
|
---|
394 | </div>
|
---|
395 | <a class="anchor" id="ac65345864040b8f067a6d0e73a8dccfa"></a>
|
---|
396 | <div class="memitem">
|
---|
397 | <div class="memproto">
|
---|
398 | <table class="memname">
|
---|
399 | <tr>
|
---|
400 | <td class="memname">float readFloatField </td>
|
---|
401 | <td>(</td>
|
---|
402 | <td class="paramtype">unsigned long </td>
|
---|
403 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
404 | </tr>
|
---|
405 | <tr>
|
---|
406 | <td class="paramkey"></td>
|
---|
407 | <td></td>
|
---|
408 | <td class="paramtype">unsigned int </td>
|
---|
409 | <td class="paramname"><em>field</em> </td>
|
---|
410 | </tr>
|
---|
411 | <tr>
|
---|
412 | <td></td>
|
---|
413 | <td>)</td>
|
---|
414 | <td></td><td></td>
|
---|
415 | </tr>
|
---|
416 | </table>
|
---|
417 | </div><div class="memdoc">
|
---|
418 |
|
---|
419 | <p>Read the latest float from a public ThingSpeak channel. </p>
|
---|
420 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
421 | <table class="params">
|
---|
422 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
423 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to read from. </td></tr>
|
---|
424 | </table>
|
---|
425 | </dd>
|
---|
426 | </dl>
|
---|
427 | <dl class="section return"><dt>Returns</dt><dd>Value read, or 0 if the field is text or there is an error. Use <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> to get more specific information. Note that NAN, INFINITY, and -INFINITY are valid results. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
428 | <div class="line"> <span class="keywordtype">float</span> voltage = ThingSpeak.<a class="code" href="class_thing_speak_class.html#a02cd79a65f1229711801fac5aec158b4">readFloatField</a>(myChannelNumber, 1);</div>
|
---|
429 | <div class="line"> Serial.print(<span class="stringliteral">"Latest voltage is: "</span>); </div>
|
---|
430 | <div class="line"> Serial.print(voltage);</div>
|
---|
431 | <div class="line"> Serial.println(<span class="stringliteral">"V"</span>); </div>
|
---|
432 | <div class="line"> delay(30000);</div>
|
---|
433 | <div class="line">}</div>
|
---|
434 | </div><!-- fragment --> </dd></dl>
|
---|
435 |
|
---|
436 | </div>
|
---|
437 | </div>
|
---|
438 | <a class="anchor" id="a1241ae5b3e08b1751495f2e45dabcc46"></a>
|
---|
439 | <div class="memitem">
|
---|
440 | <div class="memproto">
|
---|
441 | <table class="memname">
|
---|
442 | <tr>
|
---|
443 | <td class="memname">int readIntField </td>
|
---|
444 | <td>(</td>
|
---|
445 | <td class="paramtype">unsigned long </td>
|
---|
446 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
447 | </tr>
|
---|
448 | <tr>
|
---|
449 | <td class="paramkey"></td>
|
---|
450 | <td></td>
|
---|
451 | <td class="paramtype">unsigned int </td>
|
---|
452 | <td class="paramname"><em>field</em>, </td>
|
---|
453 | </tr>
|
---|
454 | <tr>
|
---|
455 | <td class="paramkey"></td>
|
---|
456 | <td></td>
|
---|
457 | <td class="paramtype">const char * </td>
|
---|
458 | <td class="paramname"><em>readAPIKey</em> </td>
|
---|
459 | </tr>
|
---|
460 | <tr>
|
---|
461 | <td></td>
|
---|
462 | <td>)</td>
|
---|
463 | <td></td><td></td>
|
---|
464 | </tr>
|
---|
465 | </table>
|
---|
466 | </div><div class="memdoc">
|
---|
467 |
|
---|
468 | <p>Read the latest int from a private ThingSpeak channel. </p>
|
---|
469 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
470 | <table class="params">
|
---|
471 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
472 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to read from. </td></tr>
|
---|
473 | <tr><td class="paramname">readAPIKey</td><td>Read API key associated with the channel. <em>If you share code with others, do <em>not</em> share this key</em> </td></tr>
|
---|
474 | </table>
|
---|
475 | </dd>
|
---|
476 | </dl>
|
---|
477 | <dl class="section return"><dt>Returns</dt><dd>Value read, or 0 if the field is text or there is an error. Use <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> to get more specific information. </dd></dl>
|
---|
478 | <dl class="section remark"><dt>Remarks</dt><dd>If the value returned is out of range for an int, the result is undefined. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
479 | <div class="line"> <span class="keywordtype">int</span> value = ThingSpeak.<a class="code" href="class_thing_speak_class.html#a1241ae5b3e08b1751495f2e45dabcc46">readIntField</a>(myChannelNumber, 1, myReadAPIKey);</div>
|
---|
480 | <div class="line"> Serial.print(<span class="stringliteral">"Latest value is: "</span>); </div>
|
---|
481 | <div class="line"> Serial.print(value);</div>
|
---|
482 | <div class="line"> delay(30000);</div>
|
---|
483 | <div class="line">}</div>
|
---|
484 | </div><!-- fragment --> </dd></dl>
|
---|
485 |
|
---|
486 | </div>
|
---|
487 | </div>
|
---|
488 | <a class="anchor" id="adb2ba704f38e591a6a391f7aa1850818"></a>
|
---|
489 | <div class="memitem">
|
---|
490 | <div class="memproto">
|
---|
491 | <table class="memname">
|
---|
492 | <tr>
|
---|
493 | <td class="memname">int readIntField </td>
|
---|
494 | <td>(</td>
|
---|
495 | <td class="paramtype">unsigned long </td>
|
---|
496 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
497 | </tr>
|
---|
498 | <tr>
|
---|
499 | <td class="paramkey"></td>
|
---|
500 | <td></td>
|
---|
501 | <td class="paramtype">unsigned int </td>
|
---|
502 | <td class="paramname"><em>field</em> </td>
|
---|
503 | </tr>
|
---|
504 | <tr>
|
---|
505 | <td></td>
|
---|
506 | <td>)</td>
|
---|
507 | <td></td><td></td>
|
---|
508 | </tr>
|
---|
509 | </table>
|
---|
510 | </div><div class="memdoc">
|
---|
511 |
|
---|
512 | <p>Read the latest int from a public ThingSpeak channel. </p>
|
---|
513 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
514 | <table class="params">
|
---|
515 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
516 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to read from. </td></tr>
|
---|
517 | </table>
|
---|
518 | </dd>
|
---|
519 | </dl>
|
---|
520 | <dl class="section return"><dt>Returns</dt><dd>Value read, or 0 if the field is text or there is an error. Use <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> to get more specific information. </dd></dl>
|
---|
521 | <dl class="section remark"><dt>Remarks</dt><dd>If the value returned is out of range for an int, the result is undefined. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
522 | <div class="line"> <span class="keywordtype">int</span> value = ThingSpeak.<a class="code" href="class_thing_speak_class.html#a1241ae5b3e08b1751495f2e45dabcc46">readIntField</a>(myChannelNumber, 1);</div>
|
---|
523 | <div class="line"> Serial.print(<span class="stringliteral">"Latest value is: "</span>); </div>
|
---|
524 | <div class="line"> Serial.print(value);</div>
|
---|
525 | <div class="line"> delay(30000);</div>
|
---|
526 | <div class="line">}</div>
|
---|
527 | </div><!-- fragment --> </dd></dl>
|
---|
528 |
|
---|
529 | </div>
|
---|
530 | </div>
|
---|
531 | <a class="anchor" id="aff3c2e94e85da016fb8c82432e015d1b"></a>
|
---|
532 | <div class="memitem">
|
---|
533 | <div class="memproto">
|
---|
534 | <table class="memname">
|
---|
535 | <tr>
|
---|
536 | <td class="memname">long readLongField </td>
|
---|
537 | <td>(</td>
|
---|
538 | <td class="paramtype">unsigned long </td>
|
---|
539 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
540 | </tr>
|
---|
541 | <tr>
|
---|
542 | <td class="paramkey"></td>
|
---|
543 | <td></td>
|
---|
544 | <td class="paramtype">unsigned int </td>
|
---|
545 | <td class="paramname"><em>field</em>, </td>
|
---|
546 | </tr>
|
---|
547 | <tr>
|
---|
548 | <td class="paramkey"></td>
|
---|
549 | <td></td>
|
---|
550 | <td class="paramtype">const char * </td>
|
---|
551 | <td class="paramname"><em>readAPIKey</em> </td>
|
---|
552 | </tr>
|
---|
553 | <tr>
|
---|
554 | <td></td>
|
---|
555 | <td>)</td>
|
---|
556 | <td></td><td></td>
|
---|
557 | </tr>
|
---|
558 | </table>
|
---|
559 | </div><div class="memdoc">
|
---|
560 |
|
---|
561 | <p>Read the latest long from a private ThingSpeak channel. </p>
|
---|
562 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
563 | <table class="params">
|
---|
564 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
565 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to read from. </td></tr>
|
---|
566 | <tr><td class="paramname">readAPIKey</td><td>Read API key associated with the channel. <em>If you share code with others, do <em>not</em> share this key</em> </td></tr>
|
---|
567 | </table>
|
---|
568 | </dd>
|
---|
569 | </dl>
|
---|
570 | <dl class="section return"><dt>Returns</dt><dd>Value read, or 0 if the field is text or there is an error. Use <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> to get more specific information. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
571 | <div class="line"> <span class="keywordtype">long</span> value = ThingSpeak.<a class="code" href="class_thing_speak_class.html#aff3c2e94e85da016fb8c82432e015d1b">readLongField</a>(myChannelNumber, 1, myReadAPIKey);</div>
|
---|
572 | <div class="line"> Serial.print(<span class="stringliteral">"Latest value is: "</span>); </div>
|
---|
573 | <div class="line"> Serial.print(value);</div>
|
---|
574 | <div class="line"> delay(30000);</div>
|
---|
575 | <div class="line">}</div>
|
---|
576 | </div><!-- fragment --> </dd></dl>
|
---|
577 |
|
---|
578 | </div>
|
---|
579 | </div>
|
---|
580 | <a class="anchor" id="aa1660fbf6444ca06dc744a244905f6d9"></a>
|
---|
581 | <div class="memitem">
|
---|
582 | <div class="memproto">
|
---|
583 | <table class="memname">
|
---|
584 | <tr>
|
---|
585 | <td class="memname">long readLongField </td>
|
---|
586 | <td>(</td>
|
---|
587 | <td class="paramtype">unsigned long </td>
|
---|
588 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
589 | </tr>
|
---|
590 | <tr>
|
---|
591 | <td class="paramkey"></td>
|
---|
592 | <td></td>
|
---|
593 | <td class="paramtype">unsigned int </td>
|
---|
594 | <td class="paramname"><em>field</em> </td>
|
---|
595 | </tr>
|
---|
596 | <tr>
|
---|
597 | <td></td>
|
---|
598 | <td>)</td>
|
---|
599 | <td></td><td></td>
|
---|
600 | </tr>
|
---|
601 | </table>
|
---|
602 | </div><div class="memdoc">
|
---|
603 |
|
---|
604 | <p>Read the latest long from a public ThingSpeak channel. </p>
|
---|
605 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
606 | <table class="params">
|
---|
607 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
608 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to read from. </td></tr>
|
---|
609 | </table>
|
---|
610 | </dd>
|
---|
611 | </dl>
|
---|
612 | <dl class="section return"><dt>Returns</dt><dd>Value read, or 0 if the field is text or there is an error. Use <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> to get more specific information. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
613 | <div class="line"> <span class="keywordtype">long</span> value = ThingSpeak.<a class="code" href="class_thing_speak_class.html#aff3c2e94e85da016fb8c82432e015d1b">readLongField</a>(myChannelNumber, 1);</div>
|
---|
614 | <div class="line"> Serial.print(<span class="stringliteral">"Latest value is: "</span>); </div>
|
---|
615 | <div class="line"> Serial.print(value);</div>
|
---|
616 | <div class="line"> delay(30000);</div>
|
---|
617 | <div class="line">}</div>
|
---|
618 | </div><!-- fragment --> </dd></dl>
|
---|
619 |
|
---|
620 | </div>
|
---|
621 | </div>
|
---|
622 | <a class="anchor" id="a578758c62a821dc9197ec6a3fdc0f7bc"></a>
|
---|
623 | <div class="memitem">
|
---|
624 | <div class="memproto">
|
---|
625 | <table class="memname">
|
---|
626 | <tr>
|
---|
627 | <td class="memname">String readRaw </td>
|
---|
628 | <td>(</td>
|
---|
629 | <td class="paramtype">unsigned long </td>
|
---|
630 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
631 | </tr>
|
---|
632 | <tr>
|
---|
633 | <td class="paramkey"></td>
|
---|
634 | <td></td>
|
---|
635 | <td class="paramtype">String </td>
|
---|
636 | <td class="paramname"><em>URLSuffix</em> </td>
|
---|
637 | </tr>
|
---|
638 | <tr>
|
---|
639 | <td></td>
|
---|
640 | <td>)</td>
|
---|
641 | <td></td><td></td>
|
---|
642 | </tr>
|
---|
643 | </table>
|
---|
644 | </div><div class="memdoc">
|
---|
645 |
|
---|
646 | <p>Read a raw response from a public ThingSpeak channel. </p>
|
---|
647 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
648 | <table class="params">
|
---|
649 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
650 | <tr><td class="paramname">URLSuffix</td><td>Raw URL to write to ThingSpeak as a String. See the documentation at <a href="https://thingspeak.com/docs/channels#get_feed">https://thingspeak.com/docs/channels#get_feed</a> </td></tr>
|
---|
651 | </table>
|
---|
652 | </dd>
|
---|
653 | </dl>
|
---|
654 | <dl class="section return"><dt>Returns</dt><dd>Response if successful, or empty string. Use <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> to get more specific information. </dd></dl>
|
---|
655 | <dl class="section remark"><dt>Remarks</dt><dd>This is low level functionality that will not be required by most users. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
656 | <div class="line"> String response = ThingSpeak.<a class="code" href="class_thing_speak_class.html#a578758c62a821dc9197ec6a3fdc0f7bc">readRaw</a>(myChannelNumber, String(<span class="stringliteral">"feeds/days=1"</span>));</div>
|
---|
657 | <div class="line"> Serial.print(<span class="stringliteral">"Response: "</span>); </div>
|
---|
658 | <div class="line"> Serial.print(response);</div>
|
---|
659 | <div class="line"> delay(30000);</div>
|
---|
660 | <div class="line">}</div>
|
---|
661 | </div><!-- fragment --> </dd></dl>
|
---|
662 |
|
---|
663 | </div>
|
---|
664 | </div>
|
---|
665 | <a class="anchor" id="abffced4cce37008c03c32d3feb38861d"></a>
|
---|
666 | <div class="memitem">
|
---|
667 | <div class="memproto">
|
---|
668 | <table class="memname">
|
---|
669 | <tr>
|
---|
670 | <td class="memname">String readRaw </td>
|
---|
671 | <td>(</td>
|
---|
672 | <td class="paramtype">unsigned long </td>
|
---|
673 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
674 | </tr>
|
---|
675 | <tr>
|
---|
676 | <td class="paramkey"></td>
|
---|
677 | <td></td>
|
---|
678 | <td class="paramtype">String </td>
|
---|
679 | <td class="paramname"><em>URLSuffix</em>, </td>
|
---|
680 | </tr>
|
---|
681 | <tr>
|
---|
682 | <td class="paramkey"></td>
|
---|
683 | <td></td>
|
---|
684 | <td class="paramtype">const char * </td>
|
---|
685 | <td class="paramname"><em>readAPIKey</em> </td>
|
---|
686 | </tr>
|
---|
687 | <tr>
|
---|
688 | <td></td>
|
---|
689 | <td>)</td>
|
---|
690 | <td></td><td></td>
|
---|
691 | </tr>
|
---|
692 | </table>
|
---|
693 | </div><div class="memdoc">
|
---|
694 |
|
---|
695 | <p>Read a raw response from a private ThingSpeak channel. </p>
|
---|
696 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
697 | <table class="params">
|
---|
698 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
699 | <tr><td class="paramname">URLSuffix</td><td>Raw URL to write to ThingSpeak as a String. See the documentation at <a href="https://thingspeak.com/docs/channels#get_feed">https://thingspeak.com/docs/channels#get_feed</a> </td></tr>
|
---|
700 | <tr><td class="paramname">readAPIKey</td><td>Read API key associated with the channel. <em>If you share code with others, do <em>not</em> share this key</em> </td></tr>
|
---|
701 | </table>
|
---|
702 | </dd>
|
---|
703 | </dl>
|
---|
704 | <dl class="section return"><dt>Returns</dt><dd>Response if successful, or empty string. Use <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> to get more specific information. </dd></dl>
|
---|
705 | <dl class="section remark"><dt>Remarks</dt><dd>This is low level functionality that will not be required by most users. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
706 | <div class="line"> String response = ThingSpeak.<a class="code" href="class_thing_speak_class.html#a578758c62a821dc9197ec6a3fdc0f7bc">readRaw</a>(myChannelNumber, String(<span class="stringliteral">"feeds/days=1"</span>), myReadAPIKey);</div>
|
---|
707 | <div class="line"> Serial.print(<span class="stringliteral">"Response: "</span>); </div>
|
---|
708 | <div class="line"> Serial.print(response);</div>
|
---|
709 | <div class="line"> delay(30000);</div>
|
---|
710 | <div class="line">}</div>
|
---|
711 | </div><!-- fragment --> </dd></dl>
|
---|
712 |
|
---|
713 | </div>
|
---|
714 | </div>
|
---|
715 | <a class="anchor" id="aa1534ea566b7f9fc951a41f8cf41f53b"></a>
|
---|
716 | <div class="memitem">
|
---|
717 | <div class="memproto">
|
---|
718 | <table class="memname">
|
---|
719 | <tr>
|
---|
720 | <td class="memname">String readStringField </td>
|
---|
721 | <td>(</td>
|
---|
722 | <td class="paramtype">unsigned long </td>
|
---|
723 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
724 | </tr>
|
---|
725 | <tr>
|
---|
726 | <td class="paramkey"></td>
|
---|
727 | <td></td>
|
---|
728 | <td class="paramtype">unsigned int </td>
|
---|
729 | <td class="paramname"><em>field</em>, </td>
|
---|
730 | </tr>
|
---|
731 | <tr>
|
---|
732 | <td class="paramkey"></td>
|
---|
733 | <td></td>
|
---|
734 | <td class="paramtype">const char * </td>
|
---|
735 | <td class="paramname"><em>readAPIKey</em> </td>
|
---|
736 | </tr>
|
---|
737 | <tr>
|
---|
738 | <td></td>
|
---|
739 | <td>)</td>
|
---|
740 | <td></td><td></td>
|
---|
741 | </tr>
|
---|
742 | </table>
|
---|
743 | </div><div class="memdoc">
|
---|
744 |
|
---|
745 | <p>Read the latest string from a private ThingSpeak channel. </p>
|
---|
746 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
747 | <table class="params">
|
---|
748 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
749 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to read from. </td></tr>
|
---|
750 | <tr><td class="paramname">readAPIKey</td><td>Read API key associated with the channel. <em>If you share code with others, do <em>not</em> share this key</em> </td></tr>
|
---|
751 | </table>
|
---|
752 | </dd>
|
---|
753 | </dl>
|
---|
754 | <dl class="section return"><dt>Returns</dt><dd>Value read (UTF8 string), or empty string if there is an error. Use <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> to get more specific information. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
755 | <div class="line"> String message = ThingSpeak.<a class="code" href="class_thing_speak_class.html#aa1534ea566b7f9fc951a41f8cf41f53b">readStringField</a>(myChannelNumber, 1, myReadAPIKey);</div>
|
---|
756 | <div class="line"> Serial.print(<span class="stringliteral">"Latest message is: "</span>); </div>
|
---|
757 | <div class="line"> Serial.println(message);</div>
|
---|
758 | <div class="line"> delay(30000);</div>
|
---|
759 | <div class="line">}</div>
|
---|
760 | </div><!-- fragment --> </dd></dl>
|
---|
761 |
|
---|
762 | </div>
|
---|
763 | </div>
|
---|
764 | <a class="anchor" id="a7ed5914c2f5c7d84672cdaae3547da96"></a>
|
---|
765 | <div class="memitem">
|
---|
766 | <div class="memproto">
|
---|
767 | <table class="memname">
|
---|
768 | <tr>
|
---|
769 | <td class="memname">String readStringField </td>
|
---|
770 | <td>(</td>
|
---|
771 | <td class="paramtype">unsigned long </td>
|
---|
772 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
773 | </tr>
|
---|
774 | <tr>
|
---|
775 | <td class="paramkey"></td>
|
---|
776 | <td></td>
|
---|
777 | <td class="paramtype">unsigned int </td>
|
---|
778 | <td class="paramname"><em>field</em> </td>
|
---|
779 | </tr>
|
---|
780 | <tr>
|
---|
781 | <td></td>
|
---|
782 | <td>)</td>
|
---|
783 | <td></td><td></td>
|
---|
784 | </tr>
|
---|
785 | </table>
|
---|
786 | </div><div class="memdoc">
|
---|
787 |
|
---|
788 | <p>Read the latest string from a public ThingSpeak channel. </p>
|
---|
789 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
790 | <table class="params">
|
---|
791 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
792 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to read from. </td></tr>
|
---|
793 | </table>
|
---|
794 | </dd>
|
---|
795 | </dl>
|
---|
796 | <dl class="section return"><dt>Returns</dt><dd>Value read (UTF8), or empty string if there is an error. Use <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> to get more specific information. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
797 | <div class="line"> String message = ThingSpeak.<a class="code" href="class_thing_speak_class.html#aa1534ea566b7f9fc951a41f8cf41f53b">readStringField</a>(myChannelNumber, 1);</div>
|
---|
798 | <div class="line"> Serial.print(<span class="stringliteral">"Latest message is: "</span>); </div>
|
---|
799 | <div class="line"> Serial.println(message);</div>
|
---|
800 | <div class="line"> delay(30000);</div>
|
---|
801 | <div class="line">}</div>
|
---|
802 | </div><!-- fragment --> </dd></dl>
|
---|
803 |
|
---|
804 | </div>
|
---|
805 | </div>
|
---|
806 | <a class="anchor" id="a1e9cc3c21e0a7360310aba628ef586c9"></a>
|
---|
807 | <div class="memitem">
|
---|
808 | <div class="memproto">
|
---|
809 | <table class="memname">
|
---|
810 | <tr>
|
---|
811 | <td class="memname">int setElevation </td>
|
---|
812 | <td>(</td>
|
---|
813 | <td class="paramtype">float </td>
|
---|
814 | <td class="paramname"><em>elevation</em></td><td>)</td>
|
---|
815 | <td></td>
|
---|
816 | </tr>
|
---|
817 | </table>
|
---|
818 | </div><div class="memdoc">
|
---|
819 |
|
---|
820 | <p>Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write, call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, <a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400" title="Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLatitude()</a> / <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e" title="Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLongitude()</a> / <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9" title="Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...">setElevation()</a>, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> </p>
|
---|
821 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
822 | <table class="params">
|
---|
823 | <tr><td class="paramname">elevation</td><td>Elevation of the measurement (meters above sea level) </td></tr>
|
---|
824 | </table>
|
---|
825 | </dd>
|
---|
826 | </dl>
|
---|
827 | <dl class="section return"><dt>Returns</dt><dd>HTTP status code of 200 if successful. See <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> for other possible return values. </dd></dl>
|
---|
828 | <dl class="section see"><dt>See also</dt><dd><a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a>, <a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400" title="Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLatitude()</a>, <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e" title="Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLongitude()</a>, <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
829 | <div class="line"> <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
|
---|
830 | <div class="line"> <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
|
---|
831 | <div class="line"> String sensor3Meaning;</div>
|
---|
832 | <div class="line"> <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
|
---|
833 | <div class="line"> <span class="keywordflow">if</span> (sensor3Value < 400) {</div>
|
---|
834 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Cold!"</span>);</div>
|
---|
835 | <div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value > 600) {</div>
|
---|
836 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Hot!"</span>);</div>
|
---|
837 | <div class="line"> } <span class="keywordflow">else</span> {</div>
|
---|
838 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Just Right"</span>);</div>
|
---|
839 | <div class="line"> }</div>
|
---|
840 | <div class="line"> <span class="keywordtype">long</span> timeRead = millis();</div>
|
---|
841 | <div class="line"></div>
|
---|
842 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
|
---|
843 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
|
---|
844 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
|
---|
845 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
|
---|
846 | <div class="line"> <a class="code" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400">setLatitude</a>(42.2833);</div>
|
---|
847 | <div class="line"> <a class="code" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e">setLongitude</a>(-71.3500);</div>
|
---|
848 | <div class="line"> <a class="code" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9">setElevation</a>(100);</div>
|
---|
849 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
|
---|
850 | <div class="line"> delay(20000);</div>
|
---|
851 | <div class="line">}</div>
|
---|
852 | </div><!-- fragment --> </dd></dl>
|
---|
853 |
|
---|
854 | </div>
|
---|
855 | </div>
|
---|
856 | <a class="anchor" id="a72eea45043ab45051c02593983d29546"></a>
|
---|
857 | <div class="memitem">
|
---|
858 | <div class="memproto">
|
---|
859 | <table class="memname">
|
---|
860 | <tr>
|
---|
861 | <td class="memname">int setField </td>
|
---|
862 | <td>(</td>
|
---|
863 | <td class="paramtype">unsigned int </td>
|
---|
864 | <td class="paramname"><em>field</em>, </td>
|
---|
865 | </tr>
|
---|
866 | <tr>
|
---|
867 | <td class="paramkey"></td>
|
---|
868 | <td></td>
|
---|
869 | <td class="paramtype">int </td>
|
---|
870 | <td class="paramname"><em>value</em> </td>
|
---|
871 | </tr>
|
---|
872 | <tr>
|
---|
873 | <td></td>
|
---|
874 | <td>)</td>
|
---|
875 | <td></td><td></td>
|
---|
876 | </tr>
|
---|
877 | </table>
|
---|
878 | </div><div class="memdoc">
|
---|
879 |
|
---|
880 | <p>Set the value of a single field that will be part of a multi-field update. To write multiple fields at once, call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> </p>
|
---|
881 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
882 | <table class="params">
|
---|
883 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to set </td></tr>
|
---|
884 | <tr><td class="paramname">value</td><td>Integer value (from -32,768 to 32,767) to set. </td></tr>
|
---|
885 | </table>
|
---|
886 | </dd>
|
---|
887 | </dl>
|
---|
888 | <dl class="section return"><dt>Returns</dt><dd>HTTP status code of 200 if successful. See <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> for other possible return values. </dd></dl>
|
---|
889 | <dl class="section see"><dt>See also</dt><dd><a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400" title="Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLatitude()</a>, <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e" title="Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLongitude()</a>, <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9" title="Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...">setElevation()</a>, <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
890 | <div class="line"> <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
|
---|
891 | <div class="line"> <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
|
---|
892 | <div class="line"> String sensor3Meaning;</div>
|
---|
893 | <div class="line"> <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
|
---|
894 | <div class="line"> <span class="keywordflow">if</span> (sensor3Value < 400) {</div>
|
---|
895 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Cold!"</span>);</div>
|
---|
896 | <div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value > 600) {</div>
|
---|
897 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Hot!"</span>);</div>
|
---|
898 | <div class="line"> } <span class="keywordflow">else</span> {</div>
|
---|
899 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Just Right"</span>);</div>
|
---|
900 | <div class="line"> }</div>
|
---|
901 | <div class="line"> <span class="keywordtype">long</span> timeRead = millis();</div>
|
---|
902 | <div class="line"></div>
|
---|
903 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
|
---|
904 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
|
---|
905 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
|
---|
906 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
|
---|
907 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
|
---|
908 | <div class="line"> delay(20000);</div>
|
---|
909 | <div class="line">}</div>
|
---|
910 | </div><!-- fragment --> </dd></dl>
|
---|
911 |
|
---|
912 | </div>
|
---|
913 | </div>
|
---|
914 | <a class="anchor" id="a8dba6e69d9cc12e5c5efe5043df02d81"></a>
|
---|
915 | <div class="memitem">
|
---|
916 | <div class="memproto">
|
---|
917 | <table class="memname">
|
---|
918 | <tr>
|
---|
919 | <td class="memname">int setField </td>
|
---|
920 | <td>(</td>
|
---|
921 | <td class="paramtype">unsigned int </td>
|
---|
922 | <td class="paramname"><em>field</em>, </td>
|
---|
923 | </tr>
|
---|
924 | <tr>
|
---|
925 | <td class="paramkey"></td>
|
---|
926 | <td></td>
|
---|
927 | <td class="paramtype">long </td>
|
---|
928 | <td class="paramname"><em>value</em> </td>
|
---|
929 | </tr>
|
---|
930 | <tr>
|
---|
931 | <td></td>
|
---|
932 | <td>)</td>
|
---|
933 | <td></td><td></td>
|
---|
934 | </tr>
|
---|
935 | </table>
|
---|
936 | </div><div class="memdoc">
|
---|
937 |
|
---|
938 | <p>Set the value of a single field that will be part of a multi-field update. To write multiple fields at once, call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> </p>
|
---|
939 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
940 | <table class="params">
|
---|
941 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to set </td></tr>
|
---|
942 | <tr><td class="paramname">value</td><td>Long value (from -2,147,483,648 to 2,147,483,647) to write. </td></tr>
|
---|
943 | </table>
|
---|
944 | </dd>
|
---|
945 | </dl>
|
---|
946 | <dl class="section return"><dt>Returns</dt><dd>HTTP status code of 200 if successful. See <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> for other possible return values. </dd></dl>
|
---|
947 | <dl class="section see"><dt>See also</dt><dd><a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400" title="Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLatitude()</a>, <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e" title="Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLongitude()</a>, <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9" title="Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...">setElevation()</a>, <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
948 | <div class="line"> <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
|
---|
949 | <div class="line"> <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
|
---|
950 | <div class="line"> String sensor3Meaning;</div>
|
---|
951 | <div class="line"> <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
|
---|
952 | <div class="line"> <span class="keywordflow">if</span> (sensor3Value < 400) {</div>
|
---|
953 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Cold!"</span>);</div>
|
---|
954 | <div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value > 600) {</div>
|
---|
955 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Hot!"</span>);</div>
|
---|
956 | <div class="line"> } <span class="keywordflow">else</span> {</div>
|
---|
957 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Just Right"</span>);</div>
|
---|
958 | <div class="line"> }</div>
|
---|
959 | <div class="line"> <span class="keywordtype">long</span> timeRead = millis();</div>
|
---|
960 | <div class="line"></div>
|
---|
961 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
|
---|
962 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
|
---|
963 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
|
---|
964 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
|
---|
965 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
|
---|
966 | <div class="line"> delay(20000);</div>
|
---|
967 | <div class="line">}</div>
|
---|
968 | </div><!-- fragment --> </dd></dl>
|
---|
969 |
|
---|
970 | </div>
|
---|
971 | </div>
|
---|
972 | <a class="anchor" id="a5d3dfc59f211651ec7b1260e29921f45"></a>
|
---|
973 | <div class="memitem">
|
---|
974 | <div class="memproto">
|
---|
975 | <table class="memname">
|
---|
976 | <tr>
|
---|
977 | <td class="memname">int setField </td>
|
---|
978 | <td>(</td>
|
---|
979 | <td class="paramtype">unsigned int </td>
|
---|
980 | <td class="paramname"><em>field</em>, </td>
|
---|
981 | </tr>
|
---|
982 | <tr>
|
---|
983 | <td class="paramkey"></td>
|
---|
984 | <td></td>
|
---|
985 | <td class="paramtype">float </td>
|
---|
986 | <td class="paramname"><em>value</em> </td>
|
---|
987 | </tr>
|
---|
988 | <tr>
|
---|
989 | <td></td>
|
---|
990 | <td>)</td>
|
---|
991 | <td></td><td></td>
|
---|
992 | </tr>
|
---|
993 | </table>
|
---|
994 | </div><div class="memdoc">
|
---|
995 |
|
---|
996 | <p>Set the value of a single field that will be part of a multi-field update. To write multiple fields at once, call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> </p>
|
---|
997 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
998 | <table class="params">
|
---|
999 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to set </td></tr>
|
---|
1000 | <tr><td class="paramname">value</td><td>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 <code>dtostrf</code>) and <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> using the resulting string. </td></tr>
|
---|
1001 | </table>
|
---|
1002 | </dd>
|
---|
1003 | </dl>
|
---|
1004 | <dl class="section return"><dt>Returns</dt><dd>HTTP status code of 200 if successful. See <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> for other possible return values. </dd></dl>
|
---|
1005 | <dl class="section see"><dt>See also</dt><dd><a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400" title="Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLatitude()</a>, <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e" title="Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLongitude()</a>, <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9" title="Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...">setElevation()</a>, <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
1006 | <div class="line"> <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
|
---|
1007 | <div class="line"> <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
|
---|
1008 | <div class="line"> String sensor3Meaning;</div>
|
---|
1009 | <div class="line"> <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
|
---|
1010 | <div class="line"> <span class="keywordflow">if</span> (sensor3Value < 400) {</div>
|
---|
1011 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Cold!"</span>);</div>
|
---|
1012 | <div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value > 600) {</div>
|
---|
1013 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Hot!"</span>);</div>
|
---|
1014 | <div class="line"> } <span class="keywordflow">else</span> {</div>
|
---|
1015 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Just Right"</span>);</div>
|
---|
1016 | <div class="line"> }</div>
|
---|
1017 | <div class="line"> <span class="keywordtype">long</span> timeRead = millis();</div>
|
---|
1018 | <div class="line"></div>
|
---|
1019 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
|
---|
1020 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
|
---|
1021 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
|
---|
1022 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
|
---|
1023 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
|
---|
1024 | <div class="line"> delay(20000);</div>
|
---|
1025 | <div class="line">}</div>
|
---|
1026 | </div><!-- fragment --> </dd></dl>
|
---|
1027 |
|
---|
1028 | </div>
|
---|
1029 | </div>
|
---|
1030 | <a class="anchor" id="a46b7090f54ed4381ff825118d50db1fd"></a>
|
---|
1031 | <div class="memitem">
|
---|
1032 | <div class="memproto">
|
---|
1033 | <table class="memname">
|
---|
1034 | <tr>
|
---|
1035 | <td class="memname">int setField </td>
|
---|
1036 | <td>(</td>
|
---|
1037 | <td class="paramtype">unsigned int </td>
|
---|
1038 | <td class="paramname"><em>field</em>, </td>
|
---|
1039 | </tr>
|
---|
1040 | <tr>
|
---|
1041 | <td class="paramkey"></td>
|
---|
1042 | <td></td>
|
---|
1043 | <td class="paramtype">const char * </td>
|
---|
1044 | <td class="paramname"><em>value</em> </td>
|
---|
1045 | </tr>
|
---|
1046 | <tr>
|
---|
1047 | <td></td>
|
---|
1048 | <td>)</td>
|
---|
1049 | <td></td><td></td>
|
---|
1050 | </tr>
|
---|
1051 | </table>
|
---|
1052 | </div><div class="memdoc">
|
---|
1053 |
|
---|
1054 | <p>Set the value of a single field that will be part of a multi-field update. To write multiple fields at once, call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> </p>
|
---|
1055 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
1056 | <table class="params">
|
---|
1057 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to set </td></tr>
|
---|
1058 | <tr><td class="paramname">value</td><td>String to write (UTF8). ThingSpeak limits this to 255 bytes. </td></tr>
|
---|
1059 | </table>
|
---|
1060 | </dd>
|
---|
1061 | </dl>
|
---|
1062 | <dl class="section return"><dt>Returns</dt><dd>HTTP status code of 200 if successful. See <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> for other possible return values. </dd></dl>
|
---|
1063 | <dl class="section see"><dt>See also</dt><dd><a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400" title="Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLatitude()</a>, <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e" title="Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLongitude()</a>, <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9" title="Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...">setElevation()</a>, <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
1064 | <div class="line"> <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
|
---|
1065 | <div class="line"> <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
|
---|
1066 | <div class="line"> String sensor3Meaning;</div>
|
---|
1067 | <div class="line"> <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
|
---|
1068 | <div class="line"> <span class="keywordflow">if</span> (sensor3Value < 400) {</div>
|
---|
1069 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Cold!"</span>);</div>
|
---|
1070 | <div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value > 600) {</div>
|
---|
1071 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Hot!"</span>);</div>
|
---|
1072 | <div class="line"> } <span class="keywordflow">else</span> {</div>
|
---|
1073 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Just Right"</span>);</div>
|
---|
1074 | <div class="line"> }</div>
|
---|
1075 | <div class="line"> <span class="keywordtype">long</span> timeRead = millis();</div>
|
---|
1076 | <div class="line"></div>
|
---|
1077 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
|
---|
1078 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
|
---|
1079 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
|
---|
1080 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
|
---|
1081 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
|
---|
1082 | <div class="line"> delay(20000);</div>
|
---|
1083 | <div class="line">}</div>
|
---|
1084 | </div><!-- fragment --> </dd></dl>
|
---|
1085 |
|
---|
1086 | </div>
|
---|
1087 | </div>
|
---|
1088 | <a class="anchor" id="a5201062087f349e50a3dda7e48312850"></a>
|
---|
1089 | <div class="memitem">
|
---|
1090 | <div class="memproto">
|
---|
1091 | <table class="memname">
|
---|
1092 | <tr>
|
---|
1093 | <td class="memname">int setField </td>
|
---|
1094 | <td>(</td>
|
---|
1095 | <td class="paramtype">unsigned int </td>
|
---|
1096 | <td class="paramname"><em>field</em>, </td>
|
---|
1097 | </tr>
|
---|
1098 | <tr>
|
---|
1099 | <td class="paramkey"></td>
|
---|
1100 | <td></td>
|
---|
1101 | <td class="paramtype">String </td>
|
---|
1102 | <td class="paramname"><em>value</em> </td>
|
---|
1103 | </tr>
|
---|
1104 | <tr>
|
---|
1105 | <td></td>
|
---|
1106 | <td>)</td>
|
---|
1107 | <td></td><td></td>
|
---|
1108 | </tr>
|
---|
1109 | </table>
|
---|
1110 | </div><div class="memdoc">
|
---|
1111 |
|
---|
1112 | <p>Set the value of a single field that will be part of a multi-field update. To write multiple fields at once, call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> </p>
|
---|
1113 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
1114 | <table class="params">
|
---|
1115 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to set </td></tr>
|
---|
1116 | <tr><td class="paramname">value</td><td>String to write (UTF8). ThingSpeak limits this to 255 bytes. </td></tr>
|
---|
1117 | </table>
|
---|
1118 | </dd>
|
---|
1119 | </dl>
|
---|
1120 | <dl class="section return"><dt>Returns</dt><dd>HTTP status code of 200 if successful. See <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> for other possible return values. </dd></dl>
|
---|
1121 | <dl class="section see"><dt>See also</dt><dd><a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400" title="Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLatitude()</a>, <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e" title="Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLongitude()</a>, <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9" title="Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...">setElevation()</a>, <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
1122 | <div class="line"> <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
|
---|
1123 | <div class="line"> <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
|
---|
1124 | <div class="line"> String sensor3Meaning;</div>
|
---|
1125 | <div class="line"> <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
|
---|
1126 | <div class="line"> <span class="keywordflow">if</span> (sensor3Value < 400) {</div>
|
---|
1127 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Cold!"</span>);</div>
|
---|
1128 | <div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value > 600) {</div>
|
---|
1129 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Hot!"</span>);</div>
|
---|
1130 | <div class="line"> } <span class="keywordflow">else</span> {</div>
|
---|
1131 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Just Right"</span>);</div>
|
---|
1132 | <div class="line"> }</div>
|
---|
1133 | <div class="line"> <span class="keywordtype">long</span> timeRead = millis();</div>
|
---|
1134 | <div class="line"></div>
|
---|
1135 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
|
---|
1136 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
|
---|
1137 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
|
---|
1138 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
|
---|
1139 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
|
---|
1140 | <div class="line"> delay(20000);</div>
|
---|
1141 | <div class="line">}</div>
|
---|
1142 | </div><!-- fragment --> </dd></dl>
|
---|
1143 |
|
---|
1144 | </div>
|
---|
1145 | </div>
|
---|
1146 | <a class="anchor" id="ad790afb71eb19b723c6fc2f17f8f4400"></a>
|
---|
1147 | <div class="memitem">
|
---|
1148 | <div class="memproto">
|
---|
1149 | <table class="memname">
|
---|
1150 | <tr>
|
---|
1151 | <td class="memname">int setLatitude </td>
|
---|
1152 | <td>(</td>
|
---|
1153 | <td class="paramtype">float </td>
|
---|
1154 | <td class="paramname"><em>latitude</em></td><td>)</td>
|
---|
1155 | <td></td>
|
---|
1156 | </tr>
|
---|
1157 | </table>
|
---|
1158 | </div><div class="memdoc">
|
---|
1159 |
|
---|
1160 | <p>Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write, call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, <a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400" title="Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLatitude()</a> / <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e" title="Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLongitude()</a> / <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9" title="Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...">setElevation()</a>, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> </p>
|
---|
1161 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
1162 | <table class="params">
|
---|
1163 | <tr><td class="paramname">latitude</td><td>Latitude of the measurement (degrees N, use negative values for degrees S) </td></tr>
|
---|
1164 | </table>
|
---|
1165 | </dd>
|
---|
1166 | </dl>
|
---|
1167 | <dl class="section return"><dt>Returns</dt><dd>HTTP status code of 200 if successful. See <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> for other possible return values. </dd></dl>
|
---|
1168 | <dl class="section see"><dt>See also</dt><dd><a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a>, <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e" title="Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLongitude()</a>, <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9" title="Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...">setElevation()</a>, <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
1169 | <div class="line"> <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
|
---|
1170 | <div class="line"> <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
|
---|
1171 | <div class="line"> String sensor3Meaning;</div>
|
---|
1172 | <div class="line"> <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
|
---|
1173 | <div class="line"> <span class="keywordflow">if</span> (sensor3Value < 400) {</div>
|
---|
1174 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Cold!"</span>);</div>
|
---|
1175 | <div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value > 600) {</div>
|
---|
1176 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Hot!"</span>);</div>
|
---|
1177 | <div class="line"> } <span class="keywordflow">else</span> {</div>
|
---|
1178 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Just Right"</span>);</div>
|
---|
1179 | <div class="line"> }</div>
|
---|
1180 | <div class="line"> <span class="keywordtype">long</span> timeRead = millis();</div>
|
---|
1181 | <div class="line"></div>
|
---|
1182 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
|
---|
1183 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
|
---|
1184 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
|
---|
1185 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
|
---|
1186 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
|
---|
1187 | <div class="line"> <a class="code" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400">setLatitude</a>(42.2833);</div>
|
---|
1188 | <div class="line"> <a class="code" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e">setLongitude</a>(-71.3500);</div>
|
---|
1189 | <div class="line"> <a class="code" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9">setElevation</a>(100);</div>
|
---|
1190 | <div class="line"> delay(20000);</div>
|
---|
1191 | <div class="line">}</div>
|
---|
1192 | </div><!-- fragment --> </dd></dl>
|
---|
1193 |
|
---|
1194 | </div>
|
---|
1195 | </div>
|
---|
1196 | <a class="anchor" id="a8cb07c25c717a5acc5d8de60b19c0c3e"></a>
|
---|
1197 | <div class="memitem">
|
---|
1198 | <div class="memproto">
|
---|
1199 | <table class="memname">
|
---|
1200 | <tr>
|
---|
1201 | <td class="memname">int setLongitude </td>
|
---|
1202 | <td>(</td>
|
---|
1203 | <td class="paramtype">float </td>
|
---|
1204 | <td class="paramname"><em>longitude</em></td><td>)</td>
|
---|
1205 | <td></td>
|
---|
1206 | </tr>
|
---|
1207 | </table>
|
---|
1208 | </div><div class="memdoc">
|
---|
1209 |
|
---|
1210 | <p>Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write, call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, <a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400" title="Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLatitude()</a> / <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e" title="Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLongitude()</a> / <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9" title="Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...">setElevation()</a>, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> </p>
|
---|
1211 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
1212 | <table class="params">
|
---|
1213 | <tr><td class="paramname">longitude</td><td>Longitude of the measurement (degrees E, use negative values for degrees W) </td></tr>
|
---|
1214 | </table>
|
---|
1215 | </dd>
|
---|
1216 | </dl>
|
---|
1217 | <dl class="section return"><dt>Returns</dt><dd>HTTP status code of 200 if successful. See <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> for other possible return values. </dd></dl>
|
---|
1218 | <dl class="section see"><dt>See also</dt><dd><a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a>, <a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400" title="Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLatitude()</a>, <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9" title="Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...">setElevation()</a>, <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
1219 | <div class="line"> <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
|
---|
1220 | <div class="line"> <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
|
---|
1221 | <div class="line"> String sensor3Meaning;</div>
|
---|
1222 | <div class="line"> <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
|
---|
1223 | <div class="line"> <span class="keywordflow">if</span> (sensor3Value < 400) {</div>
|
---|
1224 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Cold!"</span>);</div>
|
---|
1225 | <div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value > 600) {</div>
|
---|
1226 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Hot!"</span>);</div>
|
---|
1227 | <div class="line"> } <span class="keywordflow">else</span> {</div>
|
---|
1228 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Just Right"</span>);</div>
|
---|
1229 | <div class="line"> }</div>
|
---|
1230 | <div class="line"> <span class="keywordtype">long</span> timeRead = millis();</div>
|
---|
1231 | <div class="line"></div>
|
---|
1232 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
|
---|
1233 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
|
---|
1234 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
|
---|
1235 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
|
---|
1236 | <div class="line"> <a class="code" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400">setLatitude</a>(42.2833);</div>
|
---|
1237 | <div class="line"> <a class="code" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e">setLongitude</a>(-71.3500);</div>
|
---|
1238 | <div class="line"> <a class="code" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9">setElevation</a>(100);</div>
|
---|
1239 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
|
---|
1240 | <div class="line"> delay(20000);</div>
|
---|
1241 | <div class="line">}</div>
|
---|
1242 | </div><!-- fragment --> </dd></dl>
|
---|
1243 |
|
---|
1244 | </div>
|
---|
1245 | </div>
|
---|
1246 | <a class="anchor" id="a24fa89e20ef8b3314ad8270c1f81dd2d"></a>
|
---|
1247 | <div class="memitem">
|
---|
1248 | <div class="memproto">
|
---|
1249 | <table class="memname">
|
---|
1250 | <tr>
|
---|
1251 | <td class="memname">int writeField </td>
|
---|
1252 | <td>(</td>
|
---|
1253 | <td class="paramtype">unsigned long </td>
|
---|
1254 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
1255 | </tr>
|
---|
1256 | <tr>
|
---|
1257 | <td class="paramkey"></td>
|
---|
1258 | <td></td>
|
---|
1259 | <td class="paramtype">unsigned int </td>
|
---|
1260 | <td class="paramname"><em>field</em>, </td>
|
---|
1261 | </tr>
|
---|
1262 | <tr>
|
---|
1263 | <td class="paramkey"></td>
|
---|
1264 | <td></td>
|
---|
1265 | <td class="paramtype">int </td>
|
---|
1266 | <td class="paramname"><em>value</em>, </td>
|
---|
1267 | </tr>
|
---|
1268 | <tr>
|
---|
1269 | <td class="paramkey"></td>
|
---|
1270 | <td></td>
|
---|
1271 | <td class="paramtype">const char * </td>
|
---|
1272 | <td class="paramname"><em>writeAPIKey</em> </td>
|
---|
1273 | </tr>
|
---|
1274 | <tr>
|
---|
1275 | <td></td>
|
---|
1276 | <td>)</td>
|
---|
1277 | <td></td><td></td>
|
---|
1278 | </tr>
|
---|
1279 | </table>
|
---|
1280 | </div><div class="memdoc">
|
---|
1281 |
|
---|
1282 | <p>Write an integer value to a single field in a ThingSpeak channel. </p>
|
---|
1283 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
1284 | <table class="params">
|
---|
1285 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
1286 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to write to. </td></tr>
|
---|
1287 | <tr><td class="paramname">value</td><td>Integer value (from -32,768 to 32,767) to write. </td></tr>
|
---|
1288 | <tr><td class="paramname">writeAPIKey</td><td>Write API key associated with the channel. <em>If you share code with others, do <em>not</em> share this key</em> </td></tr>
|
---|
1289 | </table>
|
---|
1290 | </dd>
|
---|
1291 | </dl>
|
---|
1292 | <dl class="section return"><dt>Returns</dt><dd>HTTP status code of 200 if successful. See <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> for other possible return values. </dd></dl>
|
---|
1293 | <dl class="section remark"><dt>Remarks</dt><dd>Visit <a href="https://thingspeak.com/docs/channels">https://thingspeak.com/docs/channels</a> for more information about channels, API keys, and fields. ThingSpeak limits the number of writes to a channel to once every 15 seconds. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
1294 | <div class="line"> <span class="keywordtype">int</span> sensorValue = analogRead(A0);</div>
|
---|
1295 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(myChannelNumber, 1, sensorValue, myWriteAPIKey);</div>
|
---|
1296 | <div class="line"> delay(20000);</div>
|
---|
1297 | <div class="line">}</div>
|
---|
1298 | </div><!-- fragment --> </dd></dl>
|
---|
1299 |
|
---|
1300 | </div>
|
---|
1301 | </div>
|
---|
1302 | <a class="anchor" id="a3cc1f2fa986087cbc233a3f30d1dd957"></a>
|
---|
1303 | <div class="memitem">
|
---|
1304 | <div class="memproto">
|
---|
1305 | <table class="memname">
|
---|
1306 | <tr>
|
---|
1307 | <td class="memname">int writeField </td>
|
---|
1308 | <td>(</td>
|
---|
1309 | <td class="paramtype">unsigned long </td>
|
---|
1310 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
1311 | </tr>
|
---|
1312 | <tr>
|
---|
1313 | <td class="paramkey"></td>
|
---|
1314 | <td></td>
|
---|
1315 | <td class="paramtype">unsigned int </td>
|
---|
1316 | <td class="paramname"><em>field</em>, </td>
|
---|
1317 | </tr>
|
---|
1318 | <tr>
|
---|
1319 | <td class="paramkey"></td>
|
---|
1320 | <td></td>
|
---|
1321 | <td class="paramtype">long </td>
|
---|
1322 | <td class="paramname"><em>value</em>, </td>
|
---|
1323 | </tr>
|
---|
1324 | <tr>
|
---|
1325 | <td class="paramkey"></td>
|
---|
1326 | <td></td>
|
---|
1327 | <td class="paramtype">const char * </td>
|
---|
1328 | <td class="paramname"><em>writeAPIKey</em> </td>
|
---|
1329 | </tr>
|
---|
1330 | <tr>
|
---|
1331 | <td></td>
|
---|
1332 | <td>)</td>
|
---|
1333 | <td></td><td></td>
|
---|
1334 | </tr>
|
---|
1335 | </table>
|
---|
1336 | </div><div class="memdoc">
|
---|
1337 |
|
---|
1338 | <p>Write a long value to a single field in a ThingSpeak channel. </p>
|
---|
1339 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
1340 | <table class="params">
|
---|
1341 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
1342 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to write to. </td></tr>
|
---|
1343 | <tr><td class="paramname">value</td><td>Long value (from -2,147,483,648 to 2,147,483,647) to write. </td></tr>
|
---|
1344 | <tr><td class="paramname">writeAPIKey</td><td>Write API key associated with the channel. <em>If you share code with others, do <em>not</em> share this key</em> </td></tr>
|
---|
1345 | </table>
|
---|
1346 | </dd>
|
---|
1347 | </dl>
|
---|
1348 | <dl class="section return"><dt>Returns</dt><dd>HTTP status code of 200 if successful. See <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> for other possible return values. </dd></dl>
|
---|
1349 | <dl class="section remark"><dt>Remarks</dt><dd>Visit <a href="https://thingspeak.com/docs/channels">https://thingspeak.com/docs/channels</a> for more information about channels, API keys, and fields. ThingSpeak limits the number of writes to a channel to once every 15 seconds. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
1350 | <div class="line"> <span class="keywordtype">int</span> sensorValue = analogRead(A0);</div>
|
---|
1351 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(myChannelNumber, 1, sensorValue, myWriteAPIKey);</div>
|
---|
1352 | <div class="line"> delay(20000);</div>
|
---|
1353 | <div class="line">}</div>
|
---|
1354 | </div><!-- fragment --> </dd></dl>
|
---|
1355 |
|
---|
1356 | </div>
|
---|
1357 | </div>
|
---|
1358 | <a class="anchor" id="af41b9c173128a898ba83220f52fb93ba"></a>
|
---|
1359 | <div class="memitem">
|
---|
1360 | <div class="memproto">
|
---|
1361 | <table class="memname">
|
---|
1362 | <tr>
|
---|
1363 | <td class="memname">int writeField </td>
|
---|
1364 | <td>(</td>
|
---|
1365 | <td class="paramtype">unsigned long </td>
|
---|
1366 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
1367 | </tr>
|
---|
1368 | <tr>
|
---|
1369 | <td class="paramkey"></td>
|
---|
1370 | <td></td>
|
---|
1371 | <td class="paramtype">unsigned int </td>
|
---|
1372 | <td class="paramname"><em>field</em>, </td>
|
---|
1373 | </tr>
|
---|
1374 | <tr>
|
---|
1375 | <td class="paramkey"></td>
|
---|
1376 | <td></td>
|
---|
1377 | <td class="paramtype">float </td>
|
---|
1378 | <td class="paramname"><em>value</em>, </td>
|
---|
1379 | </tr>
|
---|
1380 | <tr>
|
---|
1381 | <td class="paramkey"></td>
|
---|
1382 | <td></td>
|
---|
1383 | <td class="paramtype">const char * </td>
|
---|
1384 | <td class="paramname"><em>writeAPIKey</em> </td>
|
---|
1385 | </tr>
|
---|
1386 | <tr>
|
---|
1387 | <td></td>
|
---|
1388 | <td>)</td>
|
---|
1389 | <td></td><td></td>
|
---|
1390 | </tr>
|
---|
1391 | </table>
|
---|
1392 | </div><div class="memdoc">
|
---|
1393 |
|
---|
1394 | <p>Write a floating point value to a single field in a ThingSpeak channel. </p>
|
---|
1395 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
1396 | <table class="params">
|
---|
1397 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
1398 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to write to. </td></tr>
|
---|
1399 | <tr><td class="paramname">value</td><td>Floating point value (from -999999000000 to 999999000000) to write. If you need more accuracy, or a wider range, you should format the number using <code>dtostrf</code> and <a class="el" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d" title="Write an integer value to a single field in a ThingSpeak channel. ">writeField()</a>. </td></tr>
|
---|
1400 | <tr><td class="paramname">writeAPIKey</td><td>Write API key associated with the channel. <em>If you share code with others, do <em>not</em> share this key</em> </td></tr>
|
---|
1401 | </table>
|
---|
1402 | </dd>
|
---|
1403 | </dl>
|
---|
1404 | <dl class="section return"><dt>Returns</dt><dd>HTTP status code of 200 if successful. See <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> for other possible return values. </dd></dl>
|
---|
1405 | <dl class="section remark"><dt>Remarks</dt><dd>Visit <a href="https://thingspeak.com/docs/channels">https://thingspeak.com/docs/channels</a> for more information about channels, API keys, and fields. ThingSpeak limits the number of writes to a channel to once every 15 seconds. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
1406 | <div class="line"> <span class="keywordtype">int</span> sensorValue = analogRead(A0);</div>
|
---|
1407 | <div class="line"> <span class="keywordtype">float</span> voltage = sensorValue * (5.0 / 1023.0);</div>
|
---|
1408 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(myChannelNumber, 1, voltage, myWriteAPIKey);</div>
|
---|
1409 | <div class="line"> delay(20000);</div>
|
---|
1410 | <div class="line">}</div>
|
---|
1411 | </div><!-- fragment --> </dd></dl>
|
---|
1412 |
|
---|
1413 | </div>
|
---|
1414 | </div>
|
---|
1415 | <a class="anchor" id="a2e7a26e6bf7b65c0e8e53302787044e2"></a>
|
---|
1416 | <div class="memitem">
|
---|
1417 | <div class="memproto">
|
---|
1418 | <table class="memname">
|
---|
1419 | <tr>
|
---|
1420 | <td class="memname">int writeField </td>
|
---|
1421 | <td>(</td>
|
---|
1422 | <td class="paramtype">unsigned long </td>
|
---|
1423 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
1424 | </tr>
|
---|
1425 | <tr>
|
---|
1426 | <td class="paramkey"></td>
|
---|
1427 | <td></td>
|
---|
1428 | <td class="paramtype">unsigned int </td>
|
---|
1429 | <td class="paramname"><em>field</em>, </td>
|
---|
1430 | </tr>
|
---|
1431 | <tr>
|
---|
1432 | <td class="paramkey"></td>
|
---|
1433 | <td></td>
|
---|
1434 | <td class="paramtype">const char * </td>
|
---|
1435 | <td class="paramname"><em>value</em>, </td>
|
---|
1436 | </tr>
|
---|
1437 | <tr>
|
---|
1438 | <td class="paramkey"></td>
|
---|
1439 | <td></td>
|
---|
1440 | <td class="paramtype">const char * </td>
|
---|
1441 | <td class="paramname"><em>writeAPIKey</em> </td>
|
---|
1442 | </tr>
|
---|
1443 | <tr>
|
---|
1444 | <td></td>
|
---|
1445 | <td>)</td>
|
---|
1446 | <td></td><td></td>
|
---|
1447 | </tr>
|
---|
1448 | </table>
|
---|
1449 | </div><div class="memdoc">
|
---|
1450 |
|
---|
1451 | <p>Write a string to a single field in a ThingSpeak channel. </p>
|
---|
1452 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
1453 | <table class="params">
|
---|
1454 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
1455 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to write to. </td></tr>
|
---|
1456 | <tr><td class="paramname">value</td><td>String to write (UTF8 string). ThingSpeak limits this field to 255 bytes. </td></tr>
|
---|
1457 | <tr><td class="paramname">writeAPIKey</td><td>Write API key associated with the channel. <em>If you share code with others, do <em>not</em> share this key</em> </td></tr>
|
---|
1458 | </table>
|
---|
1459 | </dd>
|
---|
1460 | </dl>
|
---|
1461 | <dl class="section return"><dt>Returns</dt><dd>HTTP status code of 200 if successful. See <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> for other possible return values. </dd></dl>
|
---|
1462 | <dl class="section remark"><dt>Remarks</dt><dd>Visit <a href="https://thingspeak.com/docs/channels">https://thingspeak.com/docs/channels</a> for more information about channels, API keys, and fields. ThingSpeak limits the number of writes to a channel to once every 15 seconds. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
1463 | <div class="line"> <span class="keywordtype">int</span> sensorValue = analogRead(A0);</div>
|
---|
1464 | <div class="line"> <span class="keywordflow">if</span> (sensorValue > 512) {</div>
|
---|
1465 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(myChannelNumber, 1, <span class="stringliteral">"High"</span>, myWriteAPIKey);</div>
|
---|
1466 | <div class="line"> }</div>
|
---|
1467 | <div class="line"> <span class="keywordflow">else</span> {</div>
|
---|
1468 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(myChannelNumber, 1, <span class="stringliteral">"Low"</span>, myWriteAPIKey);</div>
|
---|
1469 | <div class="line"> }</div>
|
---|
1470 | <div class="line"> delay(20000);</div>
|
---|
1471 | <div class="line">}</div>
|
---|
1472 | </div><!-- fragment --> </dd></dl>
|
---|
1473 |
|
---|
1474 | </div>
|
---|
1475 | </div>
|
---|
1476 | <a class="anchor" id="a91a8c326cb6a0b6fff38046cc90246ad"></a>
|
---|
1477 | <div class="memitem">
|
---|
1478 | <div class="memproto">
|
---|
1479 | <table class="memname">
|
---|
1480 | <tr>
|
---|
1481 | <td class="memname">int writeField </td>
|
---|
1482 | <td>(</td>
|
---|
1483 | <td class="paramtype">unsigned long </td>
|
---|
1484 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
1485 | </tr>
|
---|
1486 | <tr>
|
---|
1487 | <td class="paramkey"></td>
|
---|
1488 | <td></td>
|
---|
1489 | <td class="paramtype">unsigned int </td>
|
---|
1490 | <td class="paramname"><em>field</em>, </td>
|
---|
1491 | </tr>
|
---|
1492 | <tr>
|
---|
1493 | <td class="paramkey"></td>
|
---|
1494 | <td></td>
|
---|
1495 | <td class="paramtype">String </td>
|
---|
1496 | <td class="paramname"><em>value</em>, </td>
|
---|
1497 | </tr>
|
---|
1498 | <tr>
|
---|
1499 | <td class="paramkey"></td>
|
---|
1500 | <td></td>
|
---|
1501 | <td class="paramtype">const char * </td>
|
---|
1502 | <td class="paramname"><em>writeAPIKey</em> </td>
|
---|
1503 | </tr>
|
---|
1504 | <tr>
|
---|
1505 | <td></td>
|
---|
1506 | <td>)</td>
|
---|
1507 | <td></td><td></td>
|
---|
1508 | </tr>
|
---|
1509 | </table>
|
---|
1510 | </div><div class="memdoc">
|
---|
1511 |
|
---|
1512 | <p>Write a String to a single field in a ThingSpeak channel. </p>
|
---|
1513 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
1514 | <table class="params">
|
---|
1515 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
1516 | <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to write to. </td></tr>
|
---|
1517 | <tr><td class="paramname">value</td><td>Character array (zero terminated) to write (UTF8). ThingSpeak limits this field to 255 bytes. </td></tr>
|
---|
1518 | <tr><td class="paramname">writeAPIKey</td><td>Write API key associated with the channel. <em>If you share code with others, do <em>not</em> share this key</em> </td></tr>
|
---|
1519 | </table>
|
---|
1520 | </dd>
|
---|
1521 | </dl>
|
---|
1522 | <dl class="section return"><dt>Returns</dt><dd>HTTP status code of 200 if successful. See <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> for other possible return values. </dd></dl>
|
---|
1523 | <dl class="section remark"><dt>Remarks</dt><dd>Visit <a href="https://thingspeak.com/docs/channels">https://thingspeak.com/docs/channels</a> for more information about channels, API keys, and fields. ThingSpeak limits the number of writes to a channel to once every 15 seconds. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
1524 | <div class="line"> <span class="keywordtype">int</span> sensorValue = analogRead(A0);</div>
|
---|
1525 | <div class="line"> String meaning;</div>
|
---|
1526 | <div class="line"> <span class="keywordflow">if</span> (sensorValue < 400) {</div>
|
---|
1527 | <div class="line"> meaning = String(<span class="stringliteral">"Too Cold!"</span>);</div>
|
---|
1528 | <div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensorValue > 600) {</div>
|
---|
1529 | <div class="line"> meaning = String(<span class="stringliteral">"Too Hot!"</span>);</div>
|
---|
1530 | <div class="line"> } <span class="keywordflow">else</span> {</div>
|
---|
1531 | <div class="line"> meaning = String(<span class="stringliteral">"Just Right"</span>);</div>
|
---|
1532 | <div class="line"> }</div>
|
---|
1533 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(myChannelNumber, 1, meaning, myWriteAPIKey);</div>
|
---|
1534 | <div class="line"> delay(20000);</div>
|
---|
1535 | <div class="line">}</div>
|
---|
1536 | </div><!-- fragment --> </dd></dl>
|
---|
1537 |
|
---|
1538 | </div>
|
---|
1539 | </div>
|
---|
1540 | <a class="anchor" id="a986d1958d5aa6705a53a31f3975f8cae"></a>
|
---|
1541 | <div class="memitem">
|
---|
1542 | <div class="memproto">
|
---|
1543 | <table class="memname">
|
---|
1544 | <tr>
|
---|
1545 | <td class="memname">int writeFields </td>
|
---|
1546 | <td>(</td>
|
---|
1547 | <td class="paramtype">unsigned long </td>
|
---|
1548 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
1549 | </tr>
|
---|
1550 | <tr>
|
---|
1551 | <td class="paramkey"></td>
|
---|
1552 | <td></td>
|
---|
1553 | <td class="paramtype">const char * </td>
|
---|
1554 | <td class="paramname"><em>writeAPIKey</em> </td>
|
---|
1555 | </tr>
|
---|
1556 | <tr>
|
---|
1557 | <td></td>
|
---|
1558 | <td>)</td>
|
---|
1559 | <td></td><td></td>
|
---|
1560 | </tr>
|
---|
1561 | </table>
|
---|
1562 | </div><div class="memdoc">
|
---|
1563 |
|
---|
1564 | <p>Write a multi-field update. Call <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a> for each of the fields you want to write, <a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400" title="Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLatitude()</a> / <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e" title="Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLongitude()</a> / <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9" title="Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...">setElevation()</a>, and then call <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae" title="Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() ">writeFields()</a> </p>
|
---|
1565 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
1566 | <table class="params">
|
---|
1567 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
1568 | <tr><td class="paramname">writeAPIKey</td><td>Write API key associated with the channel. <em>If you share code with others, do <em>not</em> share this key</em> </td></tr>
|
---|
1569 | </table>
|
---|
1570 | </dd>
|
---|
1571 | </dl>
|
---|
1572 | <dl class="section return"><dt>Returns</dt><dd>HTTP status code of 200 if successful. See <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> for other possible return values. </dd></dl>
|
---|
1573 | <dl class="section see"><dt>See also</dt><dd><a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546" title="Set the value of a single field that will be part of a multi-field update. To write multiple fields a...">setField()</a>, <a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400" title="Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLatitude()</a>, <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e" title="Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...">setLongitude()</a>, <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9" title="Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...">setElevation()</a> <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
1574 | <div class="line"> <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
|
---|
1575 | <div class="line"> <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
|
---|
1576 | <div class="line"> String sensor3Meaning;</div>
|
---|
1577 | <div class="line"> <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
|
---|
1578 | <div class="line"> <span class="keywordflow">if</span> (sensor3Value < 400) {</div>
|
---|
1579 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Cold!"</span>);</div>
|
---|
1580 | <div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value > 600) {</div>
|
---|
1581 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Too Hot!"</span>);</div>
|
---|
1582 | <div class="line"> } <span class="keywordflow">else</span> {</div>
|
---|
1583 | <div class="line"> sensor3Meaning = String(<span class="stringliteral">"Just Right"</span>);</div>
|
---|
1584 | <div class="line"> }</div>
|
---|
1585 | <div class="line"> <span class="keywordtype">long</span> timeRead = millis();</div>
|
---|
1586 | <div class="line"></div>
|
---|
1587 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
|
---|
1588 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
|
---|
1589 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
|
---|
1590 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
|
---|
1591 | <div class="line"> <a class="code" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400">setLatitude</a>(42.2833);</div>
|
---|
1592 | <div class="line"> <a class="code" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e">setLongitude</a>(-71.3500);</div>
|
---|
1593 | <div class="line"> <a class="code" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9">setElevation</a>(100);</div>
|
---|
1594 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
|
---|
1595 | <div class="line"> delay(20000);</div>
|
---|
1596 | <div class="line">}</div>
|
---|
1597 | </div><!-- fragment --> </dd></dl>
|
---|
1598 |
|
---|
1599 | </div>
|
---|
1600 | </div>
|
---|
1601 | <a class="anchor" id="a2a5333f683802cb455a3713d604abb84"></a>
|
---|
1602 | <div class="memitem">
|
---|
1603 | <div class="memproto">
|
---|
1604 | <table class="memname">
|
---|
1605 | <tr>
|
---|
1606 | <td class="memname">int writeRaw </td>
|
---|
1607 | <td>(</td>
|
---|
1608 | <td class="paramtype">unsigned long </td>
|
---|
1609 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
1610 | </tr>
|
---|
1611 | <tr>
|
---|
1612 | <td class="paramkey"></td>
|
---|
1613 | <td></td>
|
---|
1614 | <td class="paramtype">const char * </td>
|
---|
1615 | <td class="paramname"><em>postMessage</em>, </td>
|
---|
1616 | </tr>
|
---|
1617 | <tr>
|
---|
1618 | <td class="paramkey"></td>
|
---|
1619 | <td></td>
|
---|
1620 | <td class="paramtype">const char * </td>
|
---|
1621 | <td class="paramname"><em>writeAPIKey</em> </td>
|
---|
1622 | </tr>
|
---|
1623 | <tr>
|
---|
1624 | <td></td>
|
---|
1625 | <td>)</td>
|
---|
1626 | <td></td><td></td>
|
---|
1627 | </tr>
|
---|
1628 | </table>
|
---|
1629 | </div><div class="memdoc">
|
---|
1630 |
|
---|
1631 | <p>Write a raw POST to a ThingSpeak channel. </p>
|
---|
1632 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
1633 | <table class="params">
|
---|
1634 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
1635 | <tr><td class="paramname">postMessage</td><td>Raw URL to write to ThingSpeak as a string. See the documentation at <a href="https://thingspeak.com/docs/channels#update_feed">https://thingspeak.com/docs/channels#update_feed</a>. </td></tr>
|
---|
1636 | <tr><td class="paramname">writeAPIKey</td><td>Write API key associated with the channel. <em>If you share code with others, do <em>not</em> share this key</em> </td></tr>
|
---|
1637 | </table>
|
---|
1638 | </dd>
|
---|
1639 | </dl>
|
---|
1640 | <dl class="section return"><dt>Returns</dt><dd>HTTP status code of 200 if successful. See <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> for other possible return values. </dd></dl>
|
---|
1641 | <dl class="section remark"><dt>Remarks</dt><dd>This is low level functionality that will not be required by most users. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
1642 | <div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> postMessage[] = <span class="stringliteral">"field1=23&created_at=2014-12-31%2023:59:59"</span>;</div>
|
---|
1643 | <div class="line"></div>
|
---|
1644 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
|
---|
1645 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
|
---|
1646 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
|
---|
1647 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
|
---|
1648 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
|
---|
1649 | <div class="line"> delay(20000);</div>
|
---|
1650 | <div class="line">}</div>
|
---|
1651 | </div><!-- fragment --> </dd></dl>
|
---|
1652 |
|
---|
1653 | </div>
|
---|
1654 | </div>
|
---|
1655 | <a class="anchor" id="a7c3415bd86e0fa2c335d3b245912fb55"></a>
|
---|
1656 | <div class="memitem">
|
---|
1657 | <div class="memproto">
|
---|
1658 | <table class="memname">
|
---|
1659 | <tr>
|
---|
1660 | <td class="memname">int writeRaw </td>
|
---|
1661 | <td>(</td>
|
---|
1662 | <td class="paramtype">unsigned long </td>
|
---|
1663 | <td class="paramname"><em>channelNumber</em>, </td>
|
---|
1664 | </tr>
|
---|
1665 | <tr>
|
---|
1666 | <td class="paramkey"></td>
|
---|
1667 | <td></td>
|
---|
1668 | <td class="paramtype">String </td>
|
---|
1669 | <td class="paramname"><em>postMessage</em>, </td>
|
---|
1670 | </tr>
|
---|
1671 | <tr>
|
---|
1672 | <td class="paramkey"></td>
|
---|
1673 | <td></td>
|
---|
1674 | <td class="paramtype">const char * </td>
|
---|
1675 | <td class="paramname"><em>writeAPIKey</em> </td>
|
---|
1676 | </tr>
|
---|
1677 | <tr>
|
---|
1678 | <td></td>
|
---|
1679 | <td>)</td>
|
---|
1680 | <td></td><td></td>
|
---|
1681 | </tr>
|
---|
1682 | </table>
|
---|
1683 | </div><div class="memdoc">
|
---|
1684 |
|
---|
1685 | <p>Write a raw POST to a ThingSpeak channel. </p>
|
---|
1686 | <dl class="params"><dt>Parameters</dt><dd>
|
---|
1687 | <table class="params">
|
---|
1688 | <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
|
---|
1689 | <tr><td class="paramname">postMessage</td><td>Raw URL to write to ThingSpeak as a String. See the documentation at <a href="https://thingspeak.com/docs/channels#update_feed">https://thingspeak.com/docs/channels#update_feed</a>. </td></tr>
|
---|
1690 | <tr><td class="paramname">writeAPIKey</td><td>Write API key associated with the channel. <em>If you share code with others, do <em>not</em> share this key</em> </td></tr>
|
---|
1691 | </table>
|
---|
1692 | </dd>
|
---|
1693 | </dl>
|
---|
1694 | <dl class="section return"><dt>Returns</dt><dd>HTTP status code of 200 if successful. See <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577" title="Get the status of the previous read. ">getLastReadStatus()</a> for other possible return values. </dd></dl>
|
---|
1695 | <dl class="section remark"><dt>Remarks</dt><dd>This is low level functionality that will not be required by most users. <div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
|
---|
1696 | <div class="line"> String postMessage = String(<span class="stringliteral">"field1=23&created_at=2014-12-31%2023:59:59"</span>);</div>
|
---|
1697 | <div class="line"> ThingSpeak.<a class="code" href="class_thing_speak_class.html#a2a5333f683802cb455a3713d604abb84">writeRaw</a>(myChannelNumber, postMessage, myWriteAPIKey);</div>
|
---|
1698 | <div class="line"> delay(20000);</div>
|
---|
1699 | <div class="line">}</div>
|
---|
1700 | </div><!-- fragment --> </dd></dl>
|
---|
1701 |
|
---|
1702 | </div>
|
---|
1703 | </div>
|
---|
1704 | </div><!-- contents -->
|
---|
1705 | <!-- HTML footer for doxygen 1.8.9.1-->
|
---|
1706 | <!-- ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
|
---|
1707 | ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
|
---|
1708 | systems that collect, analyze, and react to their environments.
|
---|
1709 | Copyright 2016, The MathWorks, Inc.
|
---|
1710 | See the accompaning licence file for licensing information.-->
|
---|
1711 | <!-- start footer part -->
|
---|
1712 | <hr class="footer"/><address class="footer"><small>
|
---|
1713 | <table border=0 width='100%'><tr>
|
---|
1714 | <td align="left" width='50%'>
|
---|
1715 | See the accompaning licence file for licensing information
|
---|
1716 | </td>
|
---|
1717 | <td align="right" width='50%'>
|
---|
1718 | Copyright © 2016 <a target=_top href=http://www.mathworks.com>The MathWorks, Inc.</a><br>
|
---|
1719 | </td>
|
---|
1720 | </tr></table>
|
---|
1721 | </small></address>
|
---|
1722 | </body>
|
---|
1723 | </html>
|
---|