Index: rtos_arduino/trunk/arduino_lib/libraries/ESP8266_Arudino_AT/Client_ESP8266.h
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/ESP8266_Arudino_AT/Client_ESP8266.h	(revision 188)
+++ rtos_arduino/trunk/arduino_lib/libraries/ESP8266_Arudino_AT/Client_ESP8266.h	(revision 189)
@@ -20,4 +20,6 @@
 
 #include "ESP8266.h"
+#include "IPAddress.h"
+#include "Client.h"
 
 class ESP8266Client: public Client, public ESP8266 {
@@ -32,4 +34,5 @@
      */
     int connect(IPAddress ip, uint16_t port) {
+        if (isConnected()) return 1;
         String ip_str;
         ip_str.concat(ip[0]); ip_str.concat(".");
@@ -41,4 +44,5 @@
     
     int connect(const char *host, uint16_t port) {
+        if (isConnected()) return 1;
         String ip_str(host);
         return (createTCP(ip_str, port))? 1 : 0;
@@ -51,5 +55,5 @@
         return 0;
     };
-    
+
     size_t write(const uint8_t *buf, size_t size){
         if(send(buf, size)){
@@ -80,5 +84,5 @@
     
     void flush(){};
-    void stop(){releaseTCP();};
+    void stop(){ if (isConnected()) { releaseTCP(); }}
     uint8_t connected(){return (isConnected())? 1 : 0;};
     operator bool(){return isConnected();};
Index: rtos_arduino/trunk/arduino_lib/libraries/ESP8266_Arudino_AT/ESP8266.cpp
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/ESP8266_Arudino_AT/ESP8266.cpp	(revision 188)
+++ rtos_arduino/trunk/arduino_lib/libraries/ESP8266_Arudino_AT/ESP8266.cpp	(revision 189)
@@ -31,4 +31,15 @@
 #ifdef TOPPERS_WITH_ARDUINO
 #define WAIT_TIMEOUT delay(1);
+#define ENTER_CRITICAL
+#define LEAVE_CRITICAL
+#else /* !TOPPERS_WITH_ARDUINO */
+#define WAIT_TIMEOUT
+#define ENTER_CRITICAL
+#define LEAVE_CRITICAL
+#endif /* TOPPERS_WITH_ARDUINO */
+
+
+#ifdef TOPPERS_WITH_ARDUINO
+#define WAIT_TIMEOUT delay(1);
 #else /* !TOPPERS_WITH_ARDUINO */
 #define WAIT_TIMEOUT
@@ -98,5 +109,4 @@
 }
 
-
 uint32_t ESP8266_RingBuffer::copy(uint8_t *pdata, uint32_t size)
 {
@@ -143,5 +153,7 @@
 {
     String version;
-    
+    int ret = 0;
+    
+    ENTER_CRITICAL;
     m_puart = &uart;
     m_baud = baud;
@@ -150,24 +162,34 @@
     rx_empty();
     
-    if (!kick()) {
-        return 1;
-    }
-    
-    eATGMR(version);
-    if(version.indexOf(ESP8266_SUPPORT_VERSION) == -1) {
-        return 2;
-    }
-    
-    return 0;
+    if (eAT()) {
+        eATGMR(version);
+        if(version.indexOf(ESP8266_SUPPORT_VERSION) == -1) {
+            ret = 2;
+        }
+    }
+    else {        
+        ret = 1;
+    }
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 bool ESP8266::kick(void)
 {
-    return eAT();
-}
-
-bool ESP8266::restart(void)
+    bool ret;
+    
+    ENTER_CRITICAL;
+    ret = eAT();
+    LEAVE_CRITICAL;
+    
+    return ret;
+}
+
+bool ESP8266::_restart(void)
 {
     unsigned long start;
+    bool ret = false;
+    
     initialize_status();
     if (eATRST()) {
@@ -179,10 +201,22 @@
             if (eAT()) {
                 delay(1500); /* Waiting for stable */
-                return true;
+                ret = true;
             }
             delay(100);
         }
     }
-    return false;
+    
+    return ret;
+}
+
+bool ESP8266::restart(void)
+{
+    bool ret;
+    
+    ENTER_CRITICAL;
+    ret = _restart();
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
@@ -190,5 +224,9 @@
 {
     String version;
+    
+    ENTER_CRITICAL;
     eATGMR(version);
+    LEAVE_CRITICAL;
+    
     return version;
 }
@@ -197,16 +235,19 @@
 {
     uint8_t mode;
-    if (!qATCWMODE_CUR(&mode)) {
-        return false;
-    }
-    if (mode == ESP8266_WMODE_STATION) {
-        return true;
-    } else {
-        if (sATCWMODE_CUR(ESP8266_WMODE_STATION) && restart()) {
-            return true;
+    bool ret = false;
+
+    ENTER_CRITICAL;
+    if (qATCWMODE_CUR(&mode)) {
+        if (mode == ESP8266_WMODE_STATION) {
+            ret = true;
         } else {
-            return false;
-        }
-    }
+            if (sATCWMODE_CUR(ESP8266_WMODE_STATION) && _restart()) {
+                ret = true;
+            }
+        }
+    }
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
@@ -214,16 +255,19 @@
 {
     uint8_t mode;
-    if (!qATCWMODE_CUR(&mode)) {
-        return false;
-    }
-    if (mode == ESP8266_WMODE_SOFTAP) {
-        return true;
-    } else {
-        if (sATCWMODE_CUR(ESP8266_WMODE_SOFTAP) && restart()) {
-            return true;
+    bool ret = false;
+
+    ENTER_CRITICAL;
+    if (qATCWMODE_CUR(&mode)) {
+        if (mode == ESP8266_WMODE_SOFTAP) {
+            ret = true;
         } else {
-            return false;
-        }
-    }
+            if (sATCWMODE_CUR(ESP8266_WMODE_SOFTAP) && _restart()) {
+                ret = true;
+            }
+        }
+    }
+    LEAVE_CRITICAL;
+
+    return ret;
 }
 
@@ -231,16 +275,19 @@
 {
     uint8_t mode;
-    if (!qATCWMODE_CUR(&mode)) {
-        return false;
-    }
-    if (mode == ESP8266_WMODE_AP_STATION) {
-        return true;
-    } else {
-        if (sATCWMODE_CUR(ESP8266_WMODE_AP_STATION) && restart()) {
-            return true;
+    bool ret = false;
+
+    ENTER_CRITICAL;
+    if (qATCWMODE_CUR(&mode)) {
+        if (mode == ESP8266_WMODE_AP_STATION) {
+            ret = true;
         } else {
-            return false;
-        }
-    }
+            if (sATCWMODE_CUR(ESP8266_WMODE_AP_STATION) && restart()) {
+                ret = true;
+            }
+        }
+    }
+    LEAVE_CRITICAL;
+
+    return ret;    
 }
 
@@ -248,5 +295,9 @@
 {
     String list;
+    
+    ENTER_CRITICAL;
     eATCWLAP(list);
+    LEAVE_CRITICAL;
+    
     return list;
 }
@@ -254,15 +305,33 @@
 bool ESP8266::joinAP(String ssid, String pwd)
 {
-    return sATCWJAP_CUR(ssid, pwd);
+    bool ret;
+
+    ENTER_CRITICAL;
+    ret = sATCWJAP_CUR(ssid, pwd);
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 bool ESP8266::leaveAP(void)
 {
-    return eATCWQAP();
+    bool ret;
+
+    ENTER_CRITICAL;
+    ret = eATCWQAP();
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 bool ESP8266::setSoftAPParam(String ssid, String pwd, uint8_t chl, uint8_t ecn)
 {
-    return sATCWSAP_CUR(ssid, pwd, chl, ecn);
+    bool ret;
+
+    ENTER_CRITICAL;
+    ret = sATCWSAP_CUR(ssid, pwd, chl, ecn);
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
@@ -270,5 +339,9 @@
 {
     String list;
+
+    ENTER_CRITICAL;
     eATCWLIF(list);
+    LEAVE_CRITICAL;
+    
     return list;
 }
@@ -277,5 +350,9 @@
 {
     String list;
+
+    ENTER_CRITICAL;
     eATCIPSTATUS(list);
+    LEAVE_CRITICAL;
+    
     return list;
 }
@@ -283,43 +360,59 @@
 String ESP8266::getLocalIP(void)
 {
-    String list;
+    String list = "";
     int32_t index_start = -1;
     int32_t index_end = -1;
-    
+
+    ENTER_CRITICAL;
     eATCIFSR(list);
     index_start = list.indexOf('\"');
     index_end   = list.indexOf('\"', list.indexOf('\"')+1);
     if ((index_start !=  -1) && (index_end != -1)) {
-        return list.substring(index_start+1, index_end);
-    }
-    return "";
+        list = list.substring(index_start+1, index_end);
+    }
+    LEAVE_CRITICAL;
+    
+    return list;
 }
 
 bool ESP8266::enableMUX(void)
 {
+    bool ret = false;
+
+    ENTER_CRITICAL;
     if (sATCIPMUX(1)) {
         mux_mode = true;
-        return true;
-      }
-    return false;
+        ret = true;
+    }
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 bool ESP8266::disableMUX(void)
 {
+    bool ret = false;
+
+    ENTER_CRITICAL;
     if (sATCIPMUX(0)){
         mux_mode = false;
-        return true;
-    }
-    return false;
+        ret = true;
+    }
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 bool ESP8266::createTCP(String addr, uint32_t port)
 {
-    bool ret;
+    bool ret = false;
     if (mux_mode) return false;
 
+    ENTER_CRITICAL;
     if((ret = sATCIPSTARTSingle("TCP", addr, port))) {
         connection_bitmap = 1;
     }
+    LEAVE_CRITICAL;
+    
     return ret;
 }
@@ -327,11 +420,14 @@
 bool ESP8266::releaseTCP(void)
 {
-    bool ret;
-    
-    if (mux_mode) return false;    
+    bool ret = false;    
+    if (mux_mode) return false;
+
+    ENTER_CRITICAL;
     if((ret = eATCIPCLOSESingle())) {
         connection_bitmap = 0;
         rx_buffer[MUXID_SINGLE].free();
     }
+    LEAVE_CRITICAL;
+    
     return ret;    
 }
@@ -339,9 +435,13 @@
 bool ESP8266::registerUDP(String addr, uint32_t port)
 {
-    bool ret;
+    bool ret = false;
     if (mux_mode) return false;
+
+    ENTER_CRITICAL;
     if((ret = sATCIPSTARTSingle("UDP", addr, port))) {
         connection_bitmap = 1;
-    }    
+    }
+    LEAVE_CRITICAL;
+    
     return ret;
 }
@@ -349,10 +449,14 @@
 bool ESP8266::unregisterUDP(void)
 {
-    bool ret;
+    bool ret = false;
     if (mux_mode) return false;
+
+    ENTER_CRITICAL;
     if((ret = eATCIPCLOSESingle())) {
         connection_bitmap = 0;
         rx_buffer[MUXID_SINGLE].free();
-    }    
+    }
+    LEAVE_CRITICAL;
+    
     return ret;    
 }
@@ -360,11 +464,14 @@
 bool ESP8266::createTCP(uint8_t mux_id, String addr, uint32_t port)
 {
-    bool ret;
+    bool ret = false;
     if (!(mux_id < ESP8266_NUM_CONNECTION)) return false;
     if (!mux_mode) return false;
-    
+
+    ENTER_CRITICAL;    
     if((ret = sATCIPSTARTMultiple(mux_id, "TCP", addr, port))) {
         connection_bitmap |= 1 << mux_id;
     }
+    LEAVE_CRITICAL;
+    
     return ret;
 }
@@ -375,9 +482,12 @@
     if (!(mux_id < ESP8266_NUM_CONNECTION)) return false;
     if (!mux_mode) return false;
-    
+
+    ENTER_CRITICAL;
     if ((ret = sATCIPCLOSEMulitple(mux_id))) {
         connection_bitmap &= ~(1 << mux_id);
         rx_buffer[mux_id].free();
     }
+    LEAVE_CRITICAL;
+    
     return ret;
 }
@@ -388,8 +498,11 @@
     if (!(mux_id < ESP8266_NUM_CONNECTION)) return false;
     if (!mux_mode) return false;
-    
+
+    ENTER_CRITICAL;
     if ((ret = sATCIPSTARTMultiple(mux_id, "UDP", addr, port))) {
         connection_bitmap |= 1 << mux_id;
     }
+    LEAVE_CRITICAL;
+    
     return ret;
 }
@@ -400,9 +513,12 @@
     if (!(mux_id < ESP8266_NUM_CONNECTION)) return false;
     if (!mux_mode) return false;
-    
+
+    ENTER_CRITICAL;
     if ((ret = sATCIPCLOSEMulitple(mux_id))) {
         connection_bitmap &= ~(1 << mux_id);
         rx_buffer[mux_id].free();
     }
+    LEAVE_CRITICAL;
+    
     return ret;    
 }
@@ -410,131 +526,228 @@
 bool ESP8266::setTCPServerTimeout(uint32_t timeout)
 {
+    bool ret;
     if (!mux_mode) return false;
-    return sATCIPSTO(timeout);
+
+    ENTER_CRITICAL;
+    ret = sATCIPSTO(timeout);
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 bool ESP8266::startTCPServer(uint32_t port)
 {
+    bool ret = false;
     if (!mux_mode) return false;
-    if (sATCIPSERVER(1, port)) {
-        return true;
-    }
-    return false;
+
+    ENTER_CRITICAL;
+    ret = sATCIPSERVER(1, port);
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 bool ESP8266::stopTCPServer(void)
 {
-    sATCIPSERVER(0);
-    return false;
+    bool ret = false;
+    
+    ENTER_CRITICAL;
+    ret = sATCIPSERVER(0);
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 bool ESP8266::startServer(uint32_t port)
 {
-    if (!mux_mode) return false;    
-    return startTCPServer(port);
+    bool ret = false;    
+    if (!mux_mode) return false;
+    
+    ENTER_CRITICAL;
+    ret = startTCPServer(port);
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 bool ESP8266::stopServer(void)
 {
-    return stopTCPServer();
+    bool ret;
+
+    ENTER_CRITICAL;
+    ret = stopTCPServer();
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 bool ESP8266::send(const uint8_t *buffer, uint32_t len)
 {
+    bool ret;
+    if (mux_mode) return false;
+
+    ENTER_CRITICAL;
+    ret = sATCIPSENDSingle(buffer, len);
+    LEAVE_CRITICAL;
+    
+    return ret;
+}
+
+bool ESP8266::send(uint8_t mux_id, const uint8_t *buffer, uint32_t len)
+{
+    bool ret;
+    if (!mux_mode) return false;
+
+    ENTER_CRITICAL;
+    ret = sATCIPSENDMultiple(mux_id, buffer, len);
+    LEAVE_CRITICAL;
+    
+    return ret;
+}
+
+bool ESP8266::send(String &str)
+{
+    bool ret;
     if (mux_mode) return 0;
-    return sATCIPSENDSingle(buffer, len);
-}
-
-bool ESP8266::send(uint8_t mux_id, const uint8_t *buffer, uint32_t len)
-{
-    if (!mux_mode) return false;
-    return sATCIPSENDMultiple(mux_id, buffer, len);
-}
-
-bool ESP8266::send(String &str)
-{
-    if (mux_mode) return 0;
-    return sATCIPSENDSingle(str);
+
+    ENTER_CRITICAL;
+    ret = sATCIPSENDSingle(str);
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 bool ESP8266::send(uint8_t mux_id, String &str)
 {
+    bool ret;
     if (!mux_mode) return false;
     if (!(mux_id < ESP8266_NUM_CONNECTION)) return false;
-    
-    return sATCIPSENDMultiple(mux_id, str);
+
+    ENTER_CRITICAL;
+    ret = sATCIPSENDMultiple(mux_id, str);
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 uint32_t ESP8266::recv(uint8_t *buffer, uint32_t buffer_size, uint32_t timeout)
 {
+    uint32_t ret;
     if (mux_mode) return 0;
-    return recvPkg(buffer, buffer_size, timeout, 0, NULL);
+
+    ENTER_CRITICAL;
+    ret = recvPkg(buffer, buffer_size, timeout, 0, NULL);
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 uint32_t ESP8266::recv(uint8_t mux_id, uint8_t *buffer, uint32_t buffer_size, uint32_t timeout)
 {
+    uint32_t ret;
     if (!mux_mode) return false;
     if (!(mux_id < ESP8266_NUM_CONNECTION)) return false;
-    
-    return recvPkg(buffer, buffer_size, timeout, mux_id, NULL);
+
+    ENTER_CRITICAL;
+    ret = recvPkg(buffer, buffer_size, timeout, mux_id, NULL);
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 uint32_t ESP8266::recv(uint8_t *coming_mux_id, uint8_t *buffer, uint32_t buffer_size, uint32_t timeout)
 {
+    uint32_t ret;
     if (!mux_mode) return false;
-    return recvPkg(buffer, buffer_size, timeout, MUXID_ANY, coming_mux_id);
+
+    ENTER_CRITICAL;
+    ret = recvPkg(buffer, buffer_size, timeout, MUXID_ANY, coming_mux_id);
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 bool ESP8266::isDataAvailable(uint8_t mux_id)
 {
+    bool ret;
     if (!mux_mode) return false;
     if (!(mux_id < ESP8266_NUM_CONNECTION)) return false;
 
-    if(rx_buffer[mux_id].length() > 0) return true;
-    rx_update();
-    if(rx_buffer[mux_id].length() > 0) return true;
-    return 0;
+    ENTER_CRITICAL;
+    if(rx_buffer[mux_id].length() > 0) ret = true;
+    if (ret == false) {
+        rx_update();
+        if(rx_buffer[mux_id].length() > 0) ret = true;
+    }    
+    LEAVE_CRITICAL;
+        
+    return ret;
 }
 
 bool ESP8266::isDataAvailable(void)
 {
+    bool ret = false;
+
+    ENTER_CRITICAL;
     if (mux_mode) {
         for(int i = 0; i < ESP8266_NUM_CONNECTION; i++){
-            if(rx_buffer[i].length() > 0) return true;
-        }
-        rx_update();
-        for(int i = 0; i < ESP8266_NUM_CONNECTION; i++){
-            if(rx_buffer[i].length() > 0) return true;
+            if(rx_buffer[i].length() > 0) ret = true;
+        }
+        if (ret == false) {
+            rx_update();
+            for(int i = 0; i < ESP8266_NUM_CONNECTION; i++){
+                if(rx_buffer[i].length() > 0) ret = true;
+            }
         }
     }
     else {
         /* single mode */
-        if(rx_buffer[0].length() > 0) return true;
-        rx_update();
-        if(rx_buffer[0].length() > 0) return true;        
-    }
-    return false;
+        if(rx_buffer[0].length() > 0) ret = true;
+        if (ret == false) {
+            rx_update();
+            if(rx_buffer[0].length() > 0) ret = true;
+        }
+    }
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 bool ESP8266::isConnected(void)
 {
-    if (mux_mode) return false;    
-    rx_update();
-    return (connection_bitmap == 1);
+    bool ret;
+    if (mux_mode) return false;
+    
+    ENTER_CRITICAL;
+    rx_update();
+    ret = (connection_bitmap == 1);
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 bool ESP8266::isConnected(uint8_t mux_id)
 {
+    bool ret;
     if (!mux_mode) return false;    
     if (!(mux_id < ESP8266_NUM_CONNECTION)) return false;
-    rx_update();
-    return ((connection_bitmap & (1<<mux_id)) != 0);
+
+    ENTER_CRITICAL;
+    rx_update();
+    ret = ((connection_bitmap & (1<<mux_id)) != 0);
+    LEAVE_CRITICAL;
+    
+    return ret;
 }
 
 bool ESP8266::getMuxCStatus(uint8_t *mux_id_ptn)
 {
-    if (!mux_mode) return false;    
+    if (!mux_mode) return false;
+
+    ENTER_CRITICAL;
     rx_update();
     *mux_id_ptn = connection_bitmap;
+    LEAVE_CRITICAL;
+    
     return true;
 }
@@ -582,5 +795,5 @@
             if (rx_cmd.indexOf("+IPD,") != -1) {
                 if((ret = recvIPD(timeout - (millis() - start), buffer, buffer_size,
-                                  mux_id, coming_mux_id)) > 0) {
+                                  mux_id, coming_mux_id)) != 0) {
                     rx_cmd = "";
                     return ret;
@@ -614,5 +827,5 @@
     uint32_t i;
     ESP8266_RingBuffer *p_rx_buffer;
-      
+
     start = millis();
     while (millis() - start < timeout) {        
@@ -665,6 +878,6 @@
                 }
                 WAIT_TIMEOUT
-            }            
-            return 0;
+            }
+            return i;
         }
         else {
@@ -691,5 +904,6 @@
                 WAIT_TIMEOUT;
             }
-        }        
+        }
+        return i;
     }
     
@@ -710,5 +924,5 @@
 
     if (rx_cmd.indexOf("+IPD,") != -1) {
-        if(recvIPD(timeout) > 0) {
+        if(recvIPD(timeout) != 0) {
             rx_cmd = "";
         }
@@ -755,5 +969,5 @@
     unsigned long start = millis();
     while (millis() - start < timeout) {
-        while (m_puart->available() > 0) {            
+        while (m_puart->available() > 0) {
             a = m_puart->read();
             rx_cmd += a;
@@ -800,4 +1014,5 @@
 bool ESP8266::eAT(void)
 {
+    rx_update();
     m_puart->println("AT");
     return recvFind("OK");
@@ -806,4 +1021,5 @@
 bool ESP8266::eATRST(void) 
 {
+    rx_update();
     m_puart->println("AT+RST");
     return recvFind("OK");
@@ -812,4 +1028,5 @@
 bool ESP8266::eATGMR(String &version)
 {
+    rx_update();
     m_puart->println("AT+GMR");
     return recvFindAndFilter("OK", "\r\r\n", "\r\nOK", version); 
@@ -823,4 +1040,5 @@
         return false;
     }
+    rx_update();
     m_puart->println("AT+CWMODE_CUR?");
     ret = recvFindAndFilter("OK", "+CWMODE_CUR:", "\r\n\r\nOK", str_mode); 
@@ -836,5 +1054,6 @@
 {
     int ret;
-    
+
+    rx_update();
     m_puart->print("AT+CWMODE_CUR=");
     m_puart->println(mode);
@@ -849,5 +1068,6 @@
     int ret;
     
-    m_puart->print("AT+CWJAP=\"");
+    rx_update();
+    m_puart->print("AT+CWJAP_CUR=\"");
     m_puart->print(ssid);
     m_puart->print("\",\"");
@@ -862,4 +1082,5 @@
 bool ESP8266::eATCWLAP(String &list)
 {
+    rx_update();
     m_puart->println("AT+CWLAP");
     return recvFindAndFilter("OK", "\r\r\n", "\r\n\r\nOK", list, 10000);
@@ -868,4 +1089,5 @@
 bool ESP8266::eATCWQAP(void)
 {
+    rx_update();
     m_puart->println("AT+CWQAP");
     return recvFind("OK");
@@ -876,4 +1098,5 @@
     int ret;
     
+    rx_update();
     m_puart->print("AT+CWSAP_CUR=\"");
     m_puart->print(ssid);
@@ -892,4 +1115,5 @@
 bool ESP8266::eATCWLIF(String &list)
 {
+    rx_update();
     m_puart->println("AT+CWLIF");
     return recvFindAndFilter("OK", "\r\r\n", "\r\n\r\nOK", list);
@@ -898,4 +1122,5 @@
 bool ESP8266::eATCIPSTATUS(String &list)
 {
+    rx_update();
     m_puart->println("AT+CIPSTATUS");
     return recvFindAndFilter("OK", "\r\r\n", "\r\n\r\nOK", list);
@@ -905,5 +1130,6 @@
 {
     int ret;
-    
+
+    rx_update();
     m_puart->print("AT+CIPSTART=\"");
     m_puart->print(type);
@@ -921,5 +1147,6 @@
 {
     int ret;
-    
+
+    rx_update();
     m_puart->print("AT+CIPSTART=");
     m_puart->print(mux_id);
@@ -938,4 +1165,6 @@
 bool ESP8266::sATCIPSENDSingle(const uint8_t *buffer, uint32_t len)
 {
+    bool ret;
+    rx_update();
     m_puart->print("AT+CIPSEND=");
     m_puart->println(len);
@@ -944,6 +1173,8 @@
             m_puart->write(buffer[i]);
         }
-        return recvFind("SEND OK", 10000);
-    }
+        ret = recvFind("SEND OK", 10000);
+        return ret;
+    }
+    
     return false;
 }
@@ -951,4 +1182,5 @@
 bool ESP8266::sATCIPSENDMultiple(uint8_t mux_id, const uint8_t *buffer, uint32_t len)
 {
+    rx_update();
     m_puart->print("AT+CIPSEND=");
     m_puart->print(mux_id);
@@ -966,4 +1198,5 @@
 bool ESP8266::sATCIPSENDSingle(String &str)
 {
+    rx_update();
     m_puart->print("AT+CIPSEND=");
     m_puart->println(str.length());
@@ -979,4 +1212,5 @@
 bool ESP8266::sATCIPSENDMultiple(uint8_t mux_id, String &str)
 {
+    rx_update();
     m_puart->print("AT+CIPSEND=");
     m_puart->print(mux_id);
@@ -996,4 +1230,5 @@
     int ret;
     
+    rx_update();
     m_puart->print("AT+CIPCLOSE=");
     m_puart->println(mux_id);
@@ -1006,10 +1241,17 @@
 bool ESP8266::eATCIPCLOSESingle(void)
 {
+    int ret;
+    
+    Serial.println(rx_cmd);
+    rx_update();
     m_puart->println("AT+CIPCLOSE");
-    return recvFind("OK", 5000);
+    ret = recvString("OK", "ERROR", "", 5000);
+    if (ret != -1) rx_cmd = "";
+    return ((ret == 1) || (ret == 2));
 }
 
 bool ESP8266::eATCIFSR(String &list)
 {
+    rx_update();
     m_puart->println("AT+CIFSR");
     return recvFindAndFilter("OK", "\r\r\n", "\r\n\r\nOK", list);
@@ -1019,5 +1261,6 @@
 {
     int ret;
-    
+
+    rx_update();
     m_puart->print("AT+CIPMUX=");
     m_puart->println(mode);
@@ -1033,4 +1276,5 @@
     
     if (mode) {
+        rx_update();
         m_puart->print("AT+CIPSERVER=1,");
         m_puart->println(port);        
@@ -1039,4 +1283,5 @@
         return (ret == 1);
     } else {
+        rx_update();
         m_puart->println("AT+CIPSERVER=0");
         ret = recvString("OK", "ERROR", "");
@@ -1047,4 +1292,5 @@
 bool ESP8266::sATCIPSTO(uint32_t timeout)
 {
+    rx_update();
     m_puart->print("AT+CIPSTO=");
     m_puart->println(timeout);
Index: rtos_arduino/trunk/arduino_lib/libraries/ESP8266_Arudino_AT/ESP8266.h
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/ESP8266_Arudino_AT/ESP8266.h	(revision 188)
+++ rtos_arduino/trunk/arduino_lib/libraries/ESP8266_Arudino_AT/ESP8266.h	(revision 189)
@@ -59,5 +59,5 @@
 };
 
-#define ESP8266_RINGBUFFER_SIZE  512
+#define ESP8266_RINGBUFFER_SIZE  1024
 
 class ESP8266_RingBuffer
@@ -559,4 +559,14 @@
 
     void recvAsyncdata(uint32_t timeout = 0);
+
+    /**
+     * Restart ESP8266 by "AT+RST". 
+     *
+     * This method will take 3 seconds or more. 
+     *
+     * @retval true - success.
+     * @retval false - failure.
+     */
+    bool _restart(void);    
     
 #ifdef ESP8266_USE_SOFTWARE_SERIAL
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/README.md
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/README.md	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/README.md	(revision 189)
@@ -0,0 +1,44 @@
+#ThingSpeak Communication Library for Arduino, ESP8266, and Particle
+
+This library enables an Arduino 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.
+
+Complete technical documentation is in the extras/documentation folder inside the library.
+
+ThingSpeak offers free data storage and analysis of time-stamped numeric or alphanumeric data. Users can access ThingSpeak by visiting http://thingspeak.com and creating a ThingSpeak user account.
+
+ThingSpeak stores data in channels. Channels support an unlimited number of timestamped observations (think of these as rows in a spreadsheet). Each channel has up to 8 fields (think of these as columns in a speadsheet). Check out this [video](http://www.mathworks.com/videos/introduction-to-thingspeak-107749.html) for an overview.
+
+Channels may be public, where anyone can see the data, or private, where only the owner and select users can read the data. Each channel has an associated Write API Key that is used to control who can write to a channel. In addition, private channels have one or more Read API Keys to control who can read from private channel. An API Key is not required to read from public channels.  Each channel can have up to 8 fields. One field is created by default.
+
+You can visualize and do online analytics of your data on ThingSpeak using the built in version of MATLAB, or use the desktop version of MATLAB to get deeper historical insight. Visit https://www.mathworks.com/hardware-support/thingspeak.html to learn more.
+
+## Installation
+#### Arduino IDE
+In the Arduino IDE, choose Sketch/Include Library/Manage Libraries.  Click the ThingSpeak Library from the list, and click the Install button.
+
+--- or ---
+
+1. Download the ZIP file (below) to your machine.
+2. In the Arduino IDE, choose Sketch/Include Library/Add Zip Library
+3. Navigate to the ZIP file, and click Open
+
+#### Spark IDE
+In the Spark Web IDE, click the libraries tab, find ThingSpeak, and choose "Include in App"
+
+## Compatible Hardware:
+
+* Arduino or compatible using a wired or Wi-Fi ethernet shield (we have tested with Uno and Mega), should work with Arduino WiFi Shield 101
+* Arduino Yun running OpenWRT-Yun Release 1.5.3 (November 13th, 2014) or later. There are known issues with earlier versions. Visit this page to get the latest version.
+* ESP8266. Tested with [SparkFun ESP8266 Thing - Dev Board](https://www.sparkfun.com/products/13711) and [NodeMCU 1.0 module](http://www.seeedstudio.com/depot/NodeMCU-v2-Lua-based-ESP8266-development-kit-p-2415.html)
+* Particle Core, [Photon](https://www.particle.io/prototype#photon), and [Electron](https://www.particle.io/prototype#electron) (Formally Spark)
+
+## Examples:
+
+The library includes several examples to help you get started. These are accessible in the Examples/ThingSpeak menu off the File menu in the Arduino IDE.
+
+* **CheerLights:** Reads the latest CheerLights color on ThingSpeak, and sets an RGB LED.
+* **ReadLastTemperature:** Reads the latest temperature from the public MathWorks weather station in Natick, MA on ThingSpeak.
+* **ReadPrivateChannel:** Reads the latest voltage value from a private channel on ThingSpeak.
+* **ReadWeatherStation:** Reads the latest weather data from the public MathWorks weather station in Natick, MA on ThingSpeak.
+* **WriteMultipleVoltages:** Reads analog voltages from pins 0-7 and writes them to the 8 fields of a channel on ThingSpeak.
+* **WriteVoltage:** Reads an analog voltage from pin 0, converts to a voltage, and writes it to a channel on ThingSpeak.
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/CheerLights/CheerLights.ino
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/CheerLights/CheerLights.ino	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/CheerLights/CheerLights.ino	(revision 189)
@@ -0,0 +1,152 @@
+/*
+  CheerLights
+  
+  Reads the latest CheerLights color on ThingSpeak, and sets a common anode RGB LED on digital pins 5, 6, and 9.
+  On Spark core, the built in RGB LED is used
+  Visit http://www.cheerlights.com for more info.
+
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for prototyping
+  systems that collect, analyze, and react to their environments.
+  
+  Copyright 2015, The MathWorks, Inc.
+
+  Documentation for the ThingSpeak Communication Library for Arduino is in the extras/documentation folder where the library was installed.
+  See the accompaning licence file for licensing information.
+*/
+
+#ifdef SPARK
+	#include "ThingSpeak/ThingSpeak.h"
+#else
+	#include "ThingSpeak.h"
+#endif
+
+// ***********************************************************************************************************
+// This example selects the correct library to use based on the board selected under the Tools menu in the IDE.
+// Yun, Wired Ethernet shield, wi-fi shield, esp8266, and Spark are all supported.
+// With Uno and Mega, the default is that you're using a wired ethernet shield (http://www.arduino.cc/en/Main/ArduinoEthernetShield)
+// If you're using a wi-fi shield (http://www.arduino.cc/en/Main/ArduinoWiFiShield), uncomment the line below
+// ***********************************************************************************************************
+//#define USE_WIFI_SHIELD
+
+// Make sure that you put a 330 ohm resistor between the arduino
+// pins and each of the color pins on the LED.
+int pinRed = 9;
+int pinGreen = 6;
+int pinBlue = 5;
+
+#ifdef ARDUINO_ARCH_AVR
+  #ifdef ARDUINO_AVR_YUN
+    #include "YunClient.h"
+    YunClient client;
+  #else
+
+    #ifdef USE_WIFI_SHIELD
+      #include <SPI.h>
+      // ESP8266 USERS -- YOU MUST COMMENT OUT THE LINE BELOW.  There's a bug in the Arduino IDE that causes it to not respect #ifdef when it comes to #includes
+      // If you get "multiple definition of `WiFi'" -- comment out the line below.
+      #include <WiFi.h>
+      char ssid[] = "<YOURNETWORK>";          //  your network SSID (name) 
+      char pass[] = "<YOURPASSWORD>";   // your network password
+      int status = WL_IDLE_STATUS;
+      WiFiClient  client;
+    #else
+      // Use wired ethernet shield
+      #include <SPI.h>
+      #include <Ethernet.h>
+      byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+      EthernetClient client;
+    #endif
+  #endif
+#endif
+
+#ifdef ARDUINO_ARCH_ESP8266
+  #include <ESP8266WiFi.h>
+  char ssid[] = "<YOURNETWORK>";          //  your network SSID (name) 
+  char pass[] = "<YOURPASSWORD>";   // your network password
+  int status = WL_IDLE_STATUS;
+  WiFiClient  client;
+#endif
+
+#ifdef SPARK
+  TCPClient client;
+#endif
+
+
+/*
+  This is the ThingSpeak channel number for CheerLights
+  https://thingspeak.com/channels/1417.  Field 1 contains a string with
+  the latest CheerLights color.
+*/
+unsigned long cheerLightsChannelNumber = 1417;
+
+void setup() {
+  #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266)
+    #ifdef ARDUINO_AVR_YUN
+      Bridge.begin();
+    #else
+      #if defined(USE_WIFI_SHIELD) || defined(ARDUINO_ARCH_ESP8266)
+         WiFi.begin(ssid, pass);
+      #else
+        Ethernet.begin(mac);
+      #endif
+    #endif
+  #endif
+  
+  ThingSpeak.begin(client);
+
+  #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266)
+      pinMode(pinRed,OUTPUT);
+      pinMode(pinGreen,OUTPUT);
+      pinMode(pinBlue,OUTPUT);
+  #endif
+}
+
+void loop() {
+  // Read the latest value from field 1 of channel 1417
+  String color = ThingSpeak.readStringField(cheerLightsChannelNumber, 1);
+  setColor(color);
+
+  // Check again in 5 seconds
+  delay(5000);
+}
+
+// List of CheerLights color names
+String colorName[] = {"none","red","pink","green","blue","cyan","white","warmwhite","oldlace","purple","magenta","yellow","orange"};
+
+// Map of RGB values for each of the Cheerlight color names
+int colorRGB[][3] = {     0,  0,  0,  // "none"
+                        255,  0,  0,  // "red"
+                        255,192,203,  // "pink"
+                          0,255,  0,  // "green"
+                          0,  0,255,  // "blue"
+                          0,255,255,  // "cyan",
+                        255,255,255,  // "white",
+                        255,223,223,  // "warmwhite",
+                        255,223,223,  // "oldlace",
+                        128,  0,128,  // "purple",
+                        255,  0,255,  // "magenta",
+                        255,255,  0,  // "yellow",
+                        255,165,  0}; // "orange"};
+
+void setColor(String color)
+{
+  // Look through the list of colors to find the one that was requested
+  for(int iColor = 0; iColor <= 12; iColor++)
+  {
+    if(color == colorName[iColor])
+    {
+      // When it matches, look up the RGB values for that color in the table,
+      // and write the red, green, and blue values.
+      #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266)
+        analogWrite(pinRed,colorRGB[iColor][0]);
+        analogWrite(pinGreen,colorRGB[iColor][1]);
+        analogWrite(pinBlue,colorRGB[iColor][2]);
+      #endif
+      #ifdef SPARK
+        RGB.control(true);
+        RGB.color(colorRGB[iColor][0], colorRGB[iColor][1], colorRGB[iColor][2]);
+      #endif
+      return;
+    }
+  }
+}
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/ReadLastTemperature/ReadLastTemperature.ino
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/ReadLastTemperature/ReadLastTemperature.ino	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/ReadLastTemperature/ReadLastTemperature.ino	(revision 189)
@@ -0,0 +1,111 @@
+/*
+  ReadLastTemperature
+  
+  Reads the latest temperature from the MathWorks weather station in Natick, MA
+  https://thingspeak.com/channels/12397 on ThingSpeak, and prints to
+  the serial port debug window every 30 seconds.
+  
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  
+  Copyright 2016, The MathWorks, Inc.
+  
+  Documentation for the ThingSpeak Communication Library for Arduino is in the extras/documentation folder where the library was installed.
+  See the accompaning licence file for licensing information.
+*/
+
+#ifdef SPARK
+	#include "ThingSpeak/ThingSpeak.h"
+#else
+	#include "ThingSpeak.h"
+#endif
+
+// ***********************************************************************************************************
+// This example selects the correct library to use based on the board selected under the Tools menu in the IDE.
+// Yun, Wired Ethernet shield, wi-fi shield, esp8266, and Spark are all supported.
+// With Uno and Mega, the default is that you're using a wired ethernet shield (http://www.arduino.cc/en/Main/ArduinoEthernetShield)
+// If you're using a wi-fi shield (http://www.arduino.cc/en/Main/ArduinoWiFiShield), uncomment the line below
+// ***********************************************************************************************************
+//#define USE_WIFI_SHIELD
+#ifdef ARDUINO_ARCH_AVR
+
+  #ifdef ARDUINO_AVR_YUN
+    #include "YunClient.h"
+    YunClient client;
+  #else
+
+    #ifdef USE_WIFI_SHIELD
+      #include <SPI.h>
+      // ESP8266 USERS -- YOU MUST COMMENT OUT THE LINE BELOW.  There's a bug in the Arduino IDE that causes it to not respect #ifdef when it comes to #includes
+      // If you get "multiple definition of `WiFi'" -- comment out the line below.
+      #include <WiFi.h>
+      char ssid[] = "<YOURNETWORK>";          //  your network SSID (name) 
+      char pass[] = "<YOURPASSWORD>";   // your network password
+      int status = WL_IDLE_STATUS;
+      WiFiClient  client;
+    #else
+      // Use wired ethernet shield
+      #include <SPI.h>
+      #include <Ethernet.h>
+      byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+      EthernetClient client;
+    #endif
+  #endif
+#endif
+
+#ifdef ARDUINO_ARCH_ESP8266
+  #include <ESP8266WiFi.h>
+  char ssid[] = "<YOURNETWORK>";          //  your network SSID (name) 
+  char pass[] = "<YOURPASSWORD>";   // your network password
+  int status = WL_IDLE_STATUS;
+  WiFiClient  client;
+#endif
+
+// On Particle Core, Photon, and Electron the results are published to the Particle dashboard using events.
+// Go to http://dashboard.particle.io, click on the logs tab, and you'll see the events coming in. 
+#ifdef SPARK
+  TCPClient client;
+#endif
+
+/*
+  This is the ThingSpeak channel number for the MathwWorks weather station
+  https://thingspeak.com/channels/12397.  It senses a number of things, including 
+  Wind Direction, Wind Speed, Humidity, Temperature, Rainfall, and Atmospheric Pressure.
+
+  Temperature is stored in field 4
+*/
+
+unsigned long weatherStationChannelNumber = 12397;
+unsigned int temperatureFieldNumber = 4;
+
+void setup() {
+  #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266)
+    Serial.begin(9600);
+    #ifdef ARDUINO_AVR_YUN
+      Bridge.begin();
+    #else
+      #if defined(USE_WIFI_SHIELD) || defined(ARDUINO_ARCH_ESP8266)
+        WiFi.begin(ssid, pass);
+      #else
+        Ethernet.begin(mac);
+      #endif
+     #endif
+  #endif
+  
+  ThingSpeak.begin(client);
+  
+}
+
+void loop() {
+  // Read the latest value from field 4 of channel 12397
+  float temperatureInF = ThingSpeak.readFloatField(weatherStationChannelNumber, temperatureFieldNumber);
+  #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266)
+    Serial.print("Current temp is: "); 
+    Serial.print(temperatureInF);
+    Serial.println(" degrees F"); 
+  #endif
+  #ifdef SPARK
+    Particle.publish("thingspeak-lasttemp", String::format("Current temp %.1f degrees F",temperatureInF),60,PRIVATE);
+  #endif
+  delay(30000); // Note that the weather station only updates once a minute
+}
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/ReadPrivateChannel/ReadPrivateChannel.ino
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/ReadPrivateChannel/ReadPrivateChannel.ino	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/ReadPrivateChannel/ReadPrivateChannel.ino	(revision 189)
@@ -0,0 +1,114 @@
+/*
+  ReadPrivateChannel
+  
+  Reads the latest voltage value from a private channel on ThingSpeak every 30 seconds
+  and prints to the serial port debug window.
+
+  For an example of how to read from a public channel, see ReadChannel example
+  
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for prototyping
+  systems that collect, analyze, and react to their environments.
+  
+  Copyright 2016, The MathWorks, Inc.
+  
+  Documentation for the ThingSpeak Communication Library for Arduino is in the extras/documentation folder where the library was installed.
+  See the accompaning licence file for licensing information.
+*/
+
+#ifdef SPARK
+	#include "ThingSpeak/ThingSpeak.h"
+#else
+	#include "ThingSpeak.h"
+#endif
+
+// ***********************************************************************************************************
+// This example selects the correct library to use based on the board selected under the Tools menu in the IDE.
+// Yun, Wired Ethernet shield, wi-fi shield, esp8266, and Spark are all supported.
+// With Uno and Mega, the default is that you're using a wired ethernet shield (http://www.arduino.cc/en/Main/ArduinoEthernetShield)
+// If you're using a wi-fi shield (http://www.arduino.cc/en/Main/ArduinoWiFiShield), uncomment the line below
+// ***********************************************************************************************************
+//#define USE_WIFI_SHIELD
+#ifdef ARDUINO_ARCH_AVR
+
+  #ifdef ARDUINO_AVR_YUN
+    #include "YunClient.h"
+    YunClient client;
+  #else
+
+    #ifdef USE_WIFI_SHIELD
+      #include <SPI.h>
+      // ESP8266 USERS -- YOU MUST COMMENT OUT THE LINE BELOW.  There's a bug in the Arduino IDE that causes it to not respect #ifdef when it comes to #includes
+      // If you get "multiple definition of `WiFi'" -- comment out the line below.
+      #include <WiFi.h>
+      char ssid[] = "<YOURNETWORK>";          //  your network SSID (name) 
+      char pass[] = "<YOURPASSWORD>";   // your network password
+      int status = WL_IDLE_STATUS;
+      WiFiClient  client;
+    #else
+      // Use wired ethernet shield
+      #include <SPI.h>
+      #include <Ethernet.h>
+      byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+      EthernetClient client;
+    #endif
+  #endif
+#endif
+
+#ifdef ARDUINO_ARCH_ESP8266
+  #include <ESP8266WiFi.h>
+  char ssid[] = "<YOURNETWORK>";          //  your network SSID (name) 
+  char pass[] = "<YOURPASSWORD>";   // your network password
+  int status = WL_IDLE_STATUS;
+  WiFiClient  client;
+#endif
+
+// Particle Core, Photon, and Electron the results are published to the Particle dashboard using events.
+// Go to http://dashboard.particle.io, click on the logs tab, and you'll see the events coming in. 
+#ifdef SPARK
+  TCPClient client;
+#endif
+
+/*
+  *****************************************************************************************
+  **** Visit https://www.thingspeak.com to sign up for a free account and create
+  **** a channel.  The video tutorial http://community.thingspeak.com/tutorials/thingspeak-channels/ 
+  **** has more information. You need to change this to your channel, and your read API key
+  **** IF YOU SHARE YOUR CODE WITH OTHERS, MAKE SURE YOU REMOVE YOUR READ API KEY!!
+  *****************************************************************************************
+
+  This is the ThingSpeak channel used in the write examples (31461).  It is private, and requires a
+  read API key to access it.  We'll read from the first field.
+*/
+unsigned long myChannelNumber = 31461;
+const char * myReadAPIKey = "NKX4Z5JGO4M5I18A";
+
+void setup() {
+  #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266)
+    Serial.begin(9600);
+    #ifdef ARDUINO_AVR_YUN
+      Bridge.begin();
+    #else
+      #if defined(USE_WIFI_SHIELD) || defined(ARDUINO_ARCH_ESP8266)
+        WiFi.begin(ssid, pass);
+      #else
+        Ethernet.begin(mac);
+      #endif
+    #endif
+  #endif
+
+  ThingSpeak.begin(client);
+}
+
+void loop() {
+  // Read the latest value from field 1 of channel 31461
+  float voltage = ThingSpeak.readFloatField(myChannelNumber, 1, myReadAPIKey);
+  #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266)
+    Serial.print("Latest voltage is: "); 
+    Serial.print(voltage);
+    Serial.println("V"); 
+  #endif
+  #ifdef SPARK
+    Particle.publish("thingspeak-readvoltage", "Latest voltage is: " + String(voltage) + "V",60,PRIVATE);
+  #endif
+  delay(30000);
+}
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/ReadWeatherStation/ReadWeatherStation.ino
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/ReadWeatherStation/ReadWeatherStation.ino	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/ReadWeatherStation/ReadWeatherStation.ino	(revision 189)
@@ -0,0 +1,144 @@
+/*
+  ReadWeatherStation
+  
+  Reads the latest weather data every 60 seconds from the public MathWorks
+  weather station in Natick, MA https://thingspeak.com/channels/12397 on ThingSpeak.
+  
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for prototyping
+  systems that collect, analyze, and react to their environments.
+  
+  Copyright 2016, The MathWorks, Inc.
+  
+  Documentation for the ThingSpeak Communication Library for Arduino is in the extras/documentation folder where the library was installed.
+  See the accompaning licence file for licensing information.
+*/
+
+#ifdef SPARK
+	#include "ThingSpeak/ThingSpeak.h"
+#else
+	#include "ThingSpeak.h"
+#endif
+
+/// ***********************************************************************************************************
+// This example selects the correct library to use based on the board selected under the Tools menu in the IDE.
+// Yun, Wired Ethernet shield, wi-fi shield, esp8266, and Spark are all supported.
+// With Uno and Mega, the default is that you're using a wired ethernet shield (http://www.arduino.cc/en/Main/ArduinoEthernetShield)
+// If you're using a wi-fi shield (http://www.arduino.cc/en/Main/ArduinoWiFiShield), uncomment the line below
+// ***********************************************************************************************************
+//#define USE_WIFI_SHIELD
+#ifdef ARDUINO_ARCH_AVR
+
+  #ifdef ARDUINO_AVR_YUN
+    #include "YunClient.h"
+    YunClient client;
+  #else
+
+    #ifdef USE_WIFI_SHIELD
+      #include <SPI.h>
+      // ESP8266 USERS -- YOU MUST COMMENT OUT THE LINE BELOW.  There's a bug in the Arduino IDE that causes it to not respect #ifdef when it comes to #includes
+      // If you get "multiple definition of `WiFi'" -- comment out the line below.
+      #include <WiFi.h>
+      char ssid[] = "<YOURNETWORK>";          //  your network SSID (name) 
+      char pass[] = "<YOURPASSWORD>";   // your network password
+      int status = WL_IDLE_STATUS;
+      WiFiClient  client;
+    #else
+      // Use wired ethernet shield
+      #include <SPI.h>
+      #include <Ethernet.h>
+      byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+      EthernetClient client;
+    #endif
+  #endif
+#endif
+
+#ifdef ARDUINO_ARCH_ESP8266
+  #include <ESP8266WiFi.h>
+  char ssid[] = "<YOURNETWORK>";          //  your network SSID (name) 
+  char pass[] = "<YOURPASSWORD>";   // your network password
+  int status = WL_IDLE_STATUS;
+  WiFiClient  client;
+#endif
+
+// On Particle Core, Photon, and Electron the results are published to the Particle dashboard using events.
+// Go to http://dashboard.particle.io, click on the logs tab, and you'll see the events coming in. 
+#ifdef SPARK
+  TCPClient client;
+#endif
+
+/*
+  This is the ThingSpeak channel number for the MathwWorks weather station
+  https://thingspeak.com/channels/12397.  It senses a number of things and puts them in the eight
+  field of the channel:
+  Field 1 - Wind Direction (degrees where 0 is North)
+  Field 2 - Wind Speed (MPH)
+  Field 3 - Humidity (%RH)
+  Field 4 - Temperature (Degrees F)
+  Field 5 - Rainfall (inches since last measurement)
+  Field 6 - Atmospheric Pressure (inHg)
+*/
+unsigned long weatherStationChannelNumber = 12397;
+
+void setup() {
+  #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266)
+    Serial.begin(9600);
+    #ifdef ARDUINO_AVR_YUN
+      Bridge.begin();
+    #else
+      #if defined(USE_WIFI_SHIELD) || defined(ARDUINO_ARCH_ESP8266)
+        WiFi.begin(ssid, pass);
+      #else
+        Ethernet.begin(mac);
+      #endif
+    #endif
+  #endif
+  
+  ThingSpeak.begin(client);
+}
+
+void loop() {
+  float windDirection = ThingSpeak.readFloatField(weatherStationChannelNumber,1);
+  float windSpeed = ThingSpeak.readFloatField(weatherStationChannelNumber,2);
+  float humidity = ThingSpeak.readFloatField(weatherStationChannelNumber,3);
+  float temperature = ThingSpeak.readFloatField(weatherStationChannelNumber,4);
+  float rainfall = ThingSpeak.readFloatField(weatherStationChannelNumber,5);
+  float pressure = ThingSpeak.readFloatField(weatherStationChannelNumber,6);
+
+  #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266)
+    Serial.println("======================================"); 
+    Serial.println("Current weather conditions in Natick: "); 
+    Serial.print(temperature);
+    Serial.print(" degrees F, "); 
+    Serial.print(humidity);
+    Serial.println("% humidity"); 
+    Serial.print("Wind at ");
+    Serial.print(windSpeed);
+    Serial.print(" MPH at "); 
+    Serial.print(windDirection);
+    Serial.println(" degrees"); 
+    Serial.print("Pressure is ");
+    Serial.print(pressure);
+    Serial.print(" inHg");
+    if(rainfall > 0)
+    {
+    	Serial.print(", and it's raining"); 
+    }
+    Serial.println(); 
+  #endif
+  #ifdef SPARK
+    Particle.publish("thingspeak-weather", "Current weather conditions in Natick: ",60,PRIVATE);
+    Particle.publish("thingspeak-weather", String(temperature) + " degrees F, " + String(humidity) + "% humidity",60,PRIVATE); 
+    Particle.publish("thingspeak-weather", "Wind at " + String(windSpeed) + " MPH at " + String (windDirection) + " degrees",60,PRIVATE); 
+    if(rainfall > 0)
+    {
+      Particle.publish("thingspeak-weather", "Pressure is " + String(pressure) + " inHg, and it's raining",60,PRIVATE);
+    }
+    else
+    {
+      Particle.publish("thingspeak-weather", "Pressure is " + String(pressure) + " inHg",60,PRIVATE);
+    }
+  #endif
+
+  delay(60000); // Note that the weather station only updates once a minute
+
+}
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/WriteMultipleVoltages/WriteMultipleVoltages.ino
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/WriteMultipleVoltages/WriteMultipleVoltages.ino	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/WriteMultipleVoltages/WriteMultipleVoltages.ino	(revision 189)
@@ -0,0 +1,129 @@
+/*
+  WriteMultipleVoltages
+  
+  Reads analog voltages from pins 0-7 and writes them to the 8 fields of a channel on ThingSpeak every 20 seconds.
+  
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for prototyping
+  systems that collect, analyze, and react to their environments.
+  
+  Copyright 2015, The MathWorks, Inc.
+  
+  Documentation for the ThingSpeak Communication Library for Arduino is in the extras/documentation folder where the library was installed.
+  See the accompaning licence file for licensing information.
+*/
+
+#ifdef SPARK
+	#include "ThingSpeak/ThingSpeak.h"
+#else
+	#include "ThingSpeak.h"
+#endif
+
+/// ***********************************************************************************************************
+// This example selects the correct library to use based on the board selected under the Tools menu in the IDE.
+// Yun, Wired Ethernet shield, wi-fi shield, esp8266, and Spark are all supported.
+// With Uno and Mega, the default is that you're using a wired ethernet shield (http://www.arduino.cc/en/Main/ArduinoEthernetShield)
+// If you're using a wi-fi shield (http://www.arduino.cc/en/Main/ArduinoWiFiShield), uncomment the line below
+// ***********************************************************************************************************
+//#define USE_WIFI_SHIELD
+#ifdef ARDUINO_ARCH_AVR
+
+  #ifdef ARDUINO_AVR_YUN
+    #include "YunClient.h"
+    YunClient client;
+  #else
+
+    #ifdef USE_WIFI_SHIELD
+      #include <SPI.h>
+      // ESP8266 USERS -- YOU MUST COMMENT OUT THE LINE BELOW.  There's a bug in the Arduino IDE that causes it to not respect #ifdef when it comes to #includes
+      // If you get "multiple definition of `WiFi'" -- comment out the line below.
+      #include <WiFi.h>
+      char ssid[] = "<YOURNETWORK>";          //  your network SSID (name) 
+      char pass[] = "<YOURPASSWORD>";   // your network password
+      int status = WL_IDLE_STATUS;
+      WiFiClient  client;
+    #else
+      // Use wired ethernet shield
+      #include <SPI.h>
+      #include <Ethernet.h>
+      byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+      EthernetClient client;
+    #endif
+  #endif
+  // On Arduino:  0 - 1023 maps to 0 - 5 volts
+  #define VOLTAGE_MAX 5.0
+  #define VOLTAGE_MAXCOUNTS 1023.0
+#endif
+
+#ifdef ARDUINO_ARCH_ESP8266
+  #include <ESP8266WiFi.h>
+  char ssid[] = "<YOURNETWORK>";          //  your network SSID (name) 
+  char pass[] = "<YOURPASSWORD>";   // your network password
+  int status = WL_IDLE_STATUS;
+  WiFiClient  client;
+  // On ESP8266:  0 - 1023 maps to 0 - 1 volts
+  #define VOLTAGE_MAX 1.0
+  #define VOLTAGE_MAXCOUNTS 1023.0
+#endif
+
+#ifdef SPARK
+    TCPClient client;
+    #define VOLTAGE_MAX 3.3
+    #define VOLTAGE_MAXCOUNTS 4095.0
+#endif
+
+/*
+  *****************************************************************************************
+  **** Visit https://www.thingspeak.com to sign up for a free account and create
+  **** a channel.  The video tutorial http://community.thingspeak.com/tutorials/thingspeak-channels/ 
+  **** has more information. You need to change this to your channel, and your write API key
+  **** IF YOU SHARE YOUR CODE WITH OTHERS, MAKE SURE YOU REMOVE YOUR WRITE API KEY!!
+  *****************************************************************************************/
+unsigned long myChannelNumber = 31461;
+const char * myWriteAPIKey = "LD79EOAAWRVYF04Y";
+
+void setup() {
+  #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266)
+    #ifdef ARDUINO_AVR_YUN
+      Bridge.begin();
+    #else
+      #if defined(USE_WIFI_SHIELD) || defined(ARDUINO_ARCH_ESP8266)
+        WiFi.begin(ssid, pass);
+      #else
+        Ethernet.begin(mac);
+      #endif
+    #endif
+  #endif
+  
+  ThingSpeak.begin(client);
+}
+
+void loop() {
+  // Read the input on each pin, convert the reading, and set each field to be sent to ThingSpeak.
+  // On Arduino:  0 - 1023 maps to 0 - 5 volts
+  // On ESP8266:  0 - 1023 maps to 0 - 1 volts
+  // On Particle: 0 - 4095 maps to 0 - 3.3 volts
+  float pinVoltage = analogRead(A0) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
+  ThingSpeak.setField(1,pinVoltage);
+  #ifndef ARDUINO_ARCH_ESP8266
+    // The ESP8266 only has one analog input, so skip this
+    pinVoltage = analogRead(A1) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
+    ThingSpeak.setField(2,pinVoltage);
+    pinVoltage = analogRead(A2) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
+    ThingSpeak.setField(3,pinVoltage);
+    pinVoltage = analogRead(A3) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
+    ThingSpeak.setField(4,pinVoltage);
+    pinVoltage = analogRead(A4) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
+    ThingSpeak.setField(5,pinVoltage);
+    pinVoltage = analogRead(A5) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
+    ThingSpeak.setField(6,pinVoltage);
+    pinVoltage = analogRead(A6) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
+    ThingSpeak.setField(7,pinVoltage);
+    pinVoltage = analogRead(A7) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
+    ThingSpeak.setField(8,pinVoltage);
+  #endif
+
+  // Write the fields that you've set all at once.
+  ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);  
+
+  delay(20000); // ThingSpeak will only accept updates every 15 seconds. 
+}
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/WriteVoltage/WriteVoltage.ino
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/WriteVoltage/WriteVoltage.ino	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/examples/WriteVoltage/WriteVoltage.ino	(revision 189)
@@ -0,0 +1,114 @@
+/*
+  WriteVoltage
+  
+  Reads an analog voltage from pin 0, and writes it to a channel on ThingSpeak every 20 seconds.
+  
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for prototyping
+  systems that collect, analyze, and react to their environments.
+  
+  Copyright 2015, The MathWorks, Inc.
+  
+  Documentation for the ThingSpeak Communication Library for Arduino is in the extras/documentation folder where the library was installed.
+  See the accompaning licence file for licensing information.
+*/
+
+#ifdef SPARK
+	#include "ThingSpeak/ThingSpeak.h"
+#else
+	#include "ThingSpeak.h"
+#endif
+
+/// ***********************************************************************************************************
+// This example selects the correct library to use based on the board selected under the Tools menu in the IDE.
+// Yun, Wired Ethernet shield, wi-fi shield, esp8266, and Spark are all supported.
+// With Uno and Mega, the default is that you're using a wired ethernet shield (http://www.arduino.cc/en/Main/ArduinoEthernetShield)
+// If you're using a wi-fi shield (http://www.arduino.cc/en/Main/ArduinoWiFiShield), uncomment the line below
+// ***********************************************************************************************************
+//#define USE_WIFI_SHIELD
+#ifdef ARDUINO_ARCH_AVR
+
+  #ifdef ARDUINO_AVR_YUN
+    #include "YunClient.h"
+    YunClient client;
+  #else
+
+    #ifdef USE_WIFI_SHIELD
+      #include <SPI.h>
+      // ESP8266 USERS -- YOU MUST COMMENT OUT THE LINE BELOW.  There's a bug in the Arduino IDE that causes it to not respect #ifdef when it comes to #includes
+      // If you get "multiple definition of `WiFi'" -- comment out the line below.
+      #include <WiFi.h>
+      char ssid[] = "<YOURNETWORK>";          //  your network SSID (name) 
+      char pass[] = "<YOURPASSWORD>";   // your network password
+      int status = WL_IDLE_STATUS;
+      WiFiClient  client;
+    #else
+      // Use wired ethernet shield
+      #include <SPI.h>
+      #include <Ethernet.h>
+      byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+      EthernetClient client;
+    #endif
+  #endif
+  // On Arduino:  0 - 1023 maps to 0 - 5 volts
+  #define VOLTAGE_MAX 5.0
+  #define VOLTAGE_MAXCOUNTS 1023.0
+#endif
+
+#ifdef ARDUINO_ARCH_ESP8266
+  #include <ESP8266WiFi.h>
+  char ssid[] = "<YOURNETWORK>";          //  your network SSID (name) 
+  char pass[] = "<YOURPASSWORD>";   // your network password
+  int status = WL_IDLE_STATUS;
+  WiFiClient  client;
+  // On ESP8266:  0 - 1023 maps to 0 - 1 volts
+  #define VOLTAGE_MAX 1.0
+  #define VOLTAGE_MAXCOUNTS 1023.0
+#endif
+
+#ifdef SPARK
+    TCPClient client;
+    // On Particle: 0 - 4095 maps to 0 - 3.3 volts
+    #define VOLTAGE_MAX 3.3
+    #define VOLTAGE_MAXCOUNTS 4095.0
+#endif
+
+/*
+  *****************************************************************************************
+  **** Visit https://www.thingspeak.com to sign up for a free account and create
+  **** a channel.  The video tutorial http://community.thingspeak.com/tutorials/thingspeak-channels/ 
+  **** has more information. You need to change this to your channel, and your write API key
+  **** IF YOU SHARE YOUR CODE WITH OTHERS, MAKE SURE YOU REMOVE YOUR WRITE API KEY!!
+  *****************************************************************************************/
+unsigned long myChannelNumber = 31461;
+const char * myWriteAPIKey = "LD79EOAAWRVYF04Y";
+
+void setup() {
+  #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266)
+    #ifdef ARDUINO_AVR_YUN
+      Bridge.begin();
+    #else
+      #if defined(USE_WIFI_SHIELD) || defined(ARDUINO_ARCH_ESP8266)
+        WiFi.begin(ssid, pass);
+      #else
+        Ethernet.begin(mac);
+      #endif
+    #endif
+  #endif
+ 
+  ThingSpeak.begin(client);
+}
+
+void loop() {
+  // read the input on analog pin 0:
+  int sensorValue = analogRead(A0);
+  // Convert the analog reading 
+  // On Arduino:  0 - 1023 maps to 0 - 5 volts
+  // On ESP8266:  0 - 1023 maps to 0 - 1 volts
+  // On Particle: 0 - 4095 maps to 0 - 3.3 volts
+  float voltage = sensorValue * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
+
+  // Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different
+  // pieces of information in a channel.  Here, we write to field 1.
+  ThingSpeak.writeField(myChannelNumber, 1, voltage, myWriteAPIKey);
+  delay(20000); // ThingSpeak will only accept updates every 15 seconds.
+}
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/_thing_speak_8h_source.html
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/_thing_speak_8h_source.html	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/_thing_speak_8h_source.html	(revision 189)
@@ -0,0 +1,910 @@
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.9.1"/>
+<title>ThingSpeak Communication Library For Arduino, ESP8266, and Particle</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr style="height: 56px;">
+  <td style="padding-left: 0.5em;">
+   <div id="projectname">ThingSpeak Communication Library</div>
+   <div id="projectbrief">Enables an Arduino, ESP8266, or Particle to write or read data to or from ThingSpeak&trade;</div>
+  </td>
+  <td valign="middle" align="right" id="projectlogo"><img alt="Logo" src="ThingSpeakLogo.jpg"/></td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.9.1 -->
+  <div id="navrow1" class="tabs">
+    <ul class="tablist">
+      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
+      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
+    </ul>
+  </div>
+<div id="nav-path" class="navpath">
+  <ul>
+<li class="navelem"><a class="el" href="dir_339e8c1d13ed9d171a31356d80f51341.html">ThingSpeak</a></li><li class="navelem"><a class="el" href="dir_9eb8a1162b9e86c4bf1f8e762bfe83d1.html">src</a></li>  </ul>
+</div>
+</div><!-- top -->
+<div class="header">
+  <div class="headertitle">
+<div class="title">ThingSpeak.h</div>  </div>
+</div><!--header-->
+<div class="contents">
+<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div>
+<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">  ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle</span></div>
+<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"></span></div>
+<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">  Enables an Arduino or other compatible hardware to write or read data to or from ThingSpeak,</span></div>
+<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">  an open data platform for the Internet of Things with MATLAB analytics and visualization. </span></div>
+<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"></span></div>
+<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment">  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building</span></div>
+<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">  systems that collect, analyze, and react to their environments.</span></div>
+<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">  </span></div>
+<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment">  Copyright 2016, The MathWorks, Inc.</span></div>
+<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> </span></div>
+<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment">  See the accompaning licence file for licensing information.</span></div>
+<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment">*/</span></div>
+<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;</div>
+<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="preprocessor">#ifndef ThingSpeak_h</span></div>
+<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="preprocessor">#define ThingSpeak_h</span></div>
+<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;</div>
+<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="comment">//#define PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="comment">//#define PRINT_HTTP</span></div>
+<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div>
+<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="preprocessor">#ifdef SPARK</span></div>
+<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <span class="comment">// Create platform defines for Particle devices</span></div>
+<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="preprocessor">    #if PLATFORM_ID == 6</span></div>
+<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<span class="preprocessor">        #define PARTICLE_PHOTON</span></div>
+<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="preprocessor">        #define PARTICLE_PHOTONELECTRON</span></div>
+<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="preprocessor">    #elif PLATFORM_ID == 10</span></div>
+<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="preprocessor">        #define PARTICLE_ELECTRON</span></div>
+<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;<span class="preprocessor">        #define PARTICLE_PHOTONELECTRON</span></div>
+<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;<span class="preprocessor">    #elif PLATFORM_ID == 0</span></div>
+<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="preprocessor">        #define PARTICLE_CORE</span></div>
+<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;<span class="preprocessor">    #endif</span></div>
+<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div>
+<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<span class="preprocessor">    #include &quot;math.h&quot;</span></div>
+<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="preprocessor">    #include &quot;application.h&quot;</span></div>
+<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="preprocessor">    #ifdef PARTICLE_PHOTONELECTRON</span></div>
+<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;        <span class="keyword">extern</span> <span class="keywordtype">char</span>* dtoa(<span class="keywordtype">double</span> val, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> prec, <span class="keywordtype">char</span> *sout);</div>
+<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;        <span class="comment">// On spark photon, There is no itoa, so map to ltoa.</span></div>
+<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;<span class="preprocessor">        #include &quot;string_convert.h&quot;</span></div>
+<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;<span class="preprocessor">        #define itoa ltoa</span></div>
+<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;<span class="preprocessor">    #else</span></div>
+<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;        <span class="comment">// On spark core, a long and an int are equivalent, and so there&#39;s no &quot;ltoa&quot; function defined.  Map it to itoa.</span></div>
+<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;        <span class="keyword">extern</span> <span class="keywordtype">char</span> * itoa(<span class="keywordtype">int</span> a, <span class="keywordtype">char</span>* buffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> radix);</div>
+<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;<span class="preprocessor">        #define ltoa itoa</span></div>
+<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;        <span class="keyword">extern</span> <span class="keywordtype">char</span> *dtostrf (<span class="keywordtype">double</span> val, <span class="keywordtype">signed</span> <span class="keywordtype">char</span> width, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> prec, <span class="keywordtype">char</span> *sout);</div>
+<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;<span class="preprocessor">    #endif</span></div>
+<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;<span class="preprocessor">#else</span></div>
+<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;<span class="preprocessor">    #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266)</span></div>
+<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;<span class="preprocessor">      #include &quot;Arduino.h&quot;</span></div>
+<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;<span class="preprocessor">      #include &lt;Client.h&gt;</span></div>
+<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;<span class="preprocessor">    #else</span></div>
+<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;<span class="preprocessor">      #error Only Arduino Yun, Uno/Mega/Due with either Wired or wi-fi Ethernet shield, ESP8266, and Spark Core/Photon/Electron are supported.</span></div>
+<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;<span class="preprocessor">    #endif</span></div>
+<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;</div>
+<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;<span class="preprocessor">#define THINGSPEAK_URL &quot;api.thingspeak.com&quot;</span></div>
+<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;<span class="preprocessor">#define THINGSPEAK_IPADDRESS IPAddress(184,106,153,149)</span></div>
+<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;<span class="preprocessor">#define THINGSPEAK_PORT_NUMBER 80</span></div>
+<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;</div>
+<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;<span class="preprocessor">#ifdef ARDUINO_ARCH_AVR</span></div>
+<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;<span class="preprocessor">    #ifdef ARDUINO_AVR_YUN</span></div>
+<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;<span class="preprocessor">        #define TS_USER_AGENT &quot;tslib-arduino/1.0 (arduino yun)&quot;</span></div>
+<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;<span class="preprocessor">    #else</span></div>
+<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;<span class="preprocessor">        #define TS_USER_AGENT &quot;tslib-arduino/1.0 (arduino uno or mega)&quot;</span></div>
+<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;<span class="preprocessor">    #endif</span></div>
+<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;<span class="preprocessor">#elif defined(ARDUINO_ARCH_ESP8266)</span></div>
+<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;<span class="preprocessor">    #define TS_USER_AGENT &quot;tslib-arduino/1.0 (ESP8266)&quot;</span></div>
+<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;<span class="preprocessor">#elif defined(SPARK)</span></div>
+<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;<span class="preprocessor">    #ifdef PARTICLE_CORE</span></div>
+<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;<span class="preprocessor">        #define TS_USER_AGENT &quot;tslib-arduino/1.0 (particle core)&quot;</span></div>
+<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;<span class="preprocessor">    #elif defined(PARTICLE_PHOTON)</span></div>
+<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;<span class="preprocessor">        #define TS_USER_AGENT &quot;tslib-arduino/1.0 (particle photon)&quot;</span></div>
+<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;<span class="preprocessor">    #elif defined(PARTICLE_ELECTRON)</span></div>
+<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;<span class="preprocessor">        #define TS_USER_AGENT &quot;tslib-arduino/1.0 (particle electron)&quot;</span></div>
+<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;<span class="preprocessor">    #endif</span></div>
+<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;<span class="preprocessor">    #define SPARK_PUBLISH_TTL 60 // Spark &quot;time to live&quot; for published messages</span></div>
+<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;<span class="preprocessor">    #define SPARK_PUBLISH_TOPIC &quot;thingspeak-debug&quot;</span></div>
+<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div>
+<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;<span class="preprocessor">#define FIELDNUM_MIN 1</span></div>
+<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;<span class="preprocessor">#define FIELDNUM_MAX 8</span></div>
+<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;<span class="preprocessor">#define FIELDLENGTH_MAX 255  // Max length for a field in ThingSpeak is 255 bytes (UTF-8)</span></div>
+<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;</div>
+<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;<span class="preprocessor">#define TIMEOUT_MS_SERVERRESPONSE 5000  // Wait up to five seconds for server to respond</span></div>
+<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;</div>
+<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;<span class="preprocessor">#define OK_SUCCESS              200     // OK / Success</span></div>
+<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;<span class="preprocessor">#define ERR_BADAPIKEY           400     // Incorrect API key (or invalid ThingSpeak server address)</span></div>
+<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;<span class="preprocessor">#define ERR_BADURL              404     // Incorrect API key (or invalid ThingSpeak server address)</span></div>
+<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;<span class="preprocessor">#define ERR_OUT_OF_RANGE        -101    // Value is out of range or string is too long (&gt; 255 bytes)</span></div>
+<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;<span class="preprocessor">#define ERR_INVALID_FIELD_NUM   -201    // Invalid field number specified</span></div>
+<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;<span class="preprocessor">#define ERR_SETFIELD_NOT_CALLED -210    // setField() was not called before writeFields()</span></div>
+<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;<span class="preprocessor">#define ERR_CONNECT_FAILED      -301    // Failed to connect to ThingSpeak</span></div>
+<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;<span class="preprocessor">#define ERR_UNEXPECTED_FAIL     -302    // Unexpected failure during write to ThingSpeak</span></div>
+<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;<span class="preprocessor">#define ERR_BAD_RESPONSE        -303    // Unable to parse response</span></div>
+<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;<span class="preprocessor">#define ERR_TIMEOUT             -304    // Timeout waiting for server to respond</span></div>
+<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;<span class="preprocessor">#define ERR_NOT_INSERTED        -401    // Point was not inserted (most probable cause is the rate limit of once every 15 seconds)</span></div>
+<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;</div>
+<div class="line"><a name="l00135"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html">  135</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_thing_speak_class.html">ThingSpeakClass</a></div>
+<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;{</div>
+<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;  <span class="keyword">public</span>:</div>
+<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;    <a class="code" href="class_thing_speak_class.html">ThingSpeakClass</a>()</div>
+<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;    {</div>
+<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;        resetWriteFields();</div>
+<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;        this-&gt;lastReadStatus = OK_SUCCESS;</div>
+<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;    };</div>
+<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;</div>
+<div class="line"><a name="l00165"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a7375bc37b4cbf132751439f5fcafd1ba">  165</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="class_thing_speak_class.html#a7375bc37b4cbf132751439f5fcafd1ba">begin</a>(Client &amp; client, <span class="keyword">const</span> <span class="keywordtype">char</span> * customHostName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> port)</div>
+<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    {</div>
+<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;<span class="preprocessor">#ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;        Serial.print(<span class="stringliteral">&quot;ts::tsBegin    (client: Client URL: &quot;</span>); Serial.print(customHostName); Serial.println(<span class="stringliteral">&quot;)&quot;</span>);</div>
+<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;    this-&gt;setClient(&amp;client);</div>
+<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;    this-&gt;setServer(customHostName, port);</div>
+<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;    resetWriteFields();</div>
+<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;    this-&gt;lastReadStatus = OK_SUCCESS;</div>
+<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;    };</div>
+<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;</div>
+<div class="line"><a name="l00198"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a8bedb31c0f619bed57944aca13b423d7">  198</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="class_thing_speak_class.html#a8bedb31c0f619bed57944aca13b423d7">begin</a>(Client &amp; client, IPAddress customIP, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> port)</div>
+<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    {</div>
+<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;<span class="preprocessor">#ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;        Serial.print(<span class="stringliteral">&quot;ts::tsBegin    (client: Client IP: &quot;</span>); Serial.print(customIP); Serial.println(<span class="stringliteral">&quot;)&quot;</span>);</div>
+<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;        this-&gt;setClient(&amp;client);</div>
+<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;        this-&gt;setServer(customIP, port);</div>
+<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;        resetWriteFields();</div>
+<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;        this-&gt;lastReadStatus = OK_SUCCESS;</div>
+<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;    };</div>
+<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;</div>
+<div class="line"><a name="l00229"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a92475d44f08bd87c798cff2e60491332">  229</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="class_thing_speak_class.html#a92475d44f08bd87c798cff2e60491332">begin</a>(Client &amp; client)</div>
+<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;    {</div>
+<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;<span class="preprocessor">#ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;        Serial.print(<span class="stringliteral">&quot;ts::tsBegin&quot;</span>);</div>
+<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;        this-&gt;setClient(&amp;client);</div>
+<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;        this-&gt;setServer();</div>
+<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;        resetWriteFields();</div>
+<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;        this-&gt;lastReadStatus = OK_SUCCESS;</div>
+<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;    };</div>
+<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;    </div>
+<div class="line"><a name="l00257"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">  257</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field, <span class="keywordtype">int</span> value, <span class="keyword">const</span> <span class="keywordtype">char</span> * writeAPIKey)</div>
+<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;    {</div>
+<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;<span class="preprocessor">#ifdef SPARK</span></div>
+<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;        <span class="comment">// On Spark, int and long are the same, so map to the long version</span></div>
+<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(channelNumber, field, (<span class="keywordtype">long</span>)value, writeAPIKey);</div>
+<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;<span class="preprocessor">#else</span></div>
+<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;        <span class="keywordtype">char</span> valueString[10];  <span class="comment">// int range is -32768 to 32768, so 7 bytes including terminator, plus a little extra</span></div>
+<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;        itoa(value, valueString, 10);</div>
+<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(channelNumber, field, valueString, writeAPIKey);</div>
+<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;    };</div>
+<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;</div>
+<div class="line"><a name="l00285"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a3cc1f2fa986087cbc233a3f30d1dd957">  285</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#a3cc1f2fa986087cbc233a3f30d1dd957">writeField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field, <span class="keywordtype">long</span> value, <span class="keyword">const</span> <span class="keywordtype">char</span> * writeAPIKey)</div>
+<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;    {</div>
+<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;        <span class="keywordtype">char</span> valueString[15];  <span class="comment">// long range is -2147483648 to 2147483647, so 12 bytes including terminator</span></div>
+<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;        ltoa(value, valueString, 10);</div>
+<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(channelNumber, field, valueString, writeAPIKey);</div>
+<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;    };</div>
+<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;</div>
+<div class="line"><a name="l00309"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#af41b9c173128a898ba83220f52fb93ba">  309</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#af41b9c173128a898ba83220f52fb93ba">writeField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field, <span class="keywordtype">float</span> value, <span class="keyword">const</span> <span class="keywordtype">char</span> * writeAPIKey)</div>
+<div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;    {</div>
+<div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;            Serial.print(<span class="stringliteral">&quot;ts::writeField (channelNumber: &quot;</span>); Serial.print(channelNumber); Serial.print(<span class="stringliteral">&quot; writeAPIKey: &quot;</span>); Serial.print(writeAPIKey); Serial.print(<span class="stringliteral">&quot; field: &quot;</span>); Serial.print(field); Serial.print(<span class="stringliteral">&quot; value: &quot;</span>); Serial.print(value,5); Serial.println(<span class="stringliteral">&quot;)&quot;</span>);</div>
+<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;        <span class="keywordtype">char</span> valueString[20]; <span class="comment">// range is -999999000000.00000 to 999999000000.00000, so 19 + 1 for the terminator</span></div>
+<div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;        <span class="keywordtype">int</span> status = convertFloatToChar(value, valueString);</div>
+<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;        <span class="keywordflow">if</span>(status != OK_SUCCESS) <span class="keywordflow">return</span> status;</div>
+<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;</div>
+<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(channelNumber, field, valueString, writeAPIKey);</div>
+<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;    };</div>
+<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;</div>
+<div class="line"><a name="l00342"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a2e7a26e6bf7b65c0e8e53302787044e2">  342</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#a2e7a26e6bf7b65c0e8e53302787044e2">writeField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field, <span class="keyword">const</span> <span class="keywordtype">char</span> * value, <span class="keyword">const</span> <span class="keywordtype">char</span> * writeAPIKey)</div>
+<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;    {</div>
+<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(channelNumber, field, String(value), writeAPIKey);</div>
+<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;    };</div>
+<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;</div>
+<div class="line"><a name="l00371"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a91a8c326cb6a0b6fff38046cc90246ad">  371</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#a91a8c326cb6a0b6fff38046cc90246ad">writeField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field, String value, <span class="keyword">const</span> <span class="keywordtype">char</span> * writeAPIKey)</div>
+<div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;    {</div>
+<div class="line"><a name="l00373"></a><span class="lineno">  373</span>&#160;        <span class="comment">// Invalid field number specified</span></div>
+<div class="line"><a name="l00374"></a><span class="lineno">  374</span>&#160;        <span class="keywordflow">if</span>(field &lt; FIELDNUM_MIN || field &gt; FIELDNUM_MAX) <span class="keywordflow">return</span> ERR_INVALID_FIELD_NUM;</div>
+<div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;        <span class="comment">// Max # bytes for ThingSpeak field is 255</span></div>
+<div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160;        <span class="keywordflow">if</span>(value.length() &gt; FIELDLENGTH_MAX) <span class="keywordflow">return</span> ERR_OUT_OF_RANGE;</div>
+<div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;        </div>
+<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;<span class="preprocessor">          #ifdef SPARK</span></div>
+<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;            Particle.publish(SPARK_PUBLISH_TOPIC, <span class="stringliteral">&quot;writeField (&quot;</span> + String(channelNumber) + <span class="stringliteral">&quot;, &quot;</span> + String(writeAPIKey) + <span class="stringliteral">&quot;, &quot;</span> + String(field) + <span class="stringliteral">&quot;, &quot;</span> + String(value) + <span class="stringliteral">&quot;)&quot;</span>, SPARK_PUBLISH_TTL, PRIVATE);</div>
+<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;<span class="preprocessor">          #else</span></div>
+<div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160;            Serial.print(<span class="stringliteral">&quot;ts::writeField (channelNumber: &quot;</span>); Serial.print(channelNumber); Serial.print(<span class="stringliteral">&quot; writeAPIKey: &quot;</span>); Serial.print(writeAPIKey); Serial.print(<span class="stringliteral">&quot; field: &quot;</span>); Serial.print(field); Serial.print(<span class="stringliteral">&quot; value: \&quot;&quot;</span>); Serial.print(value); Serial.println(<span class="stringliteral">&quot;\&quot;)&quot;</span>);</div>
+<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160;<span class="preprocessor">          #endif</span></div>
+<div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;        String postMessage = String(<span class="stringliteral">&quot;field&quot;</span>) + String(field) + <span class="stringliteral">&quot;=&quot;</span> + value;</div>
+<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#a2a5333f683802cb455a3713d604abb84">writeRaw</a>(channelNumber, postMessage, writeAPIKey);</div>
+<div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;    };</div>
+<div class="line"><a name="l00388"></a><span class="lineno">  388</span>&#160;</div>
+<div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160;    </div>
+<div class="line"><a name="l00421"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">  421</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field, <span class="keywordtype">int</span> value)</div>
+<div class="line"><a name="l00422"></a><span class="lineno">  422</span>&#160;    {</div>
+<div class="line"><a name="l00423"></a><span class="lineno">  423</span>&#160;<span class="preprocessor">#ifdef SPARK</span></div>
+<div class="line"><a name="l00424"></a><span class="lineno">  424</span>&#160;        <span class="comment">// On Spark, int and long are the same, so map to the long version</span></div>
+<div class="line"><a name="l00425"></a><span class="lineno">  425</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(field, (<span class="keywordtype">long</span>)value);</div>
+<div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;<span class="preprocessor">#else</span></div>
+<div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160;        <span class="keywordtype">char</span> valueString[10];  <span class="comment">// int range is -32768 to 32768, so 7 bytes including terminator</span></div>
+<div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;        itoa(value, valueString, 10);</div>
+<div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;        </div>
+<div class="line"><a name="l00430"></a><span class="lineno">  430</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(field, valueString);</div>
+<div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160;<span class="preprocessor">#endif</span></div>
+<div class="line"><a name="l00432"></a><span class="lineno">  432</span>&#160;    };</div>
+<div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160;</div>
+<div class="line"><a name="l00465"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a8dba6e69d9cc12e5c5efe5043df02d81">  465</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#a8dba6e69d9cc12e5c5efe5043df02d81">setField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field, <span class="keywordtype">long</span> value)</div>
+<div class="line"><a name="l00466"></a><span class="lineno">  466</span>&#160;    {</div>
+<div class="line"><a name="l00467"></a><span class="lineno">  467</span>&#160;        <span class="keywordtype">char</span> valueString[15];  <span class="comment">// long range is -2147483648 to 2147483647, so 12 bytes including terminator</span></div>
+<div class="line"><a name="l00468"></a><span class="lineno">  468</span>&#160;        ltoa(value, valueString, 10);</div>
+<div class="line"><a name="l00469"></a><span class="lineno">  469</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(field, valueString);</div>
+<div class="line"><a name="l00470"></a><span class="lineno">  470</span>&#160;    };</div>
+<div class="line"><a name="l00471"></a><span class="lineno">  471</span>&#160;</div>
+<div class="line"><a name="l00472"></a><span class="lineno">  472</span>&#160;</div>
+<div class="line"><a name="l00504"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a5d3dfc59f211651ec7b1260e29921f45">  504</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#a5d3dfc59f211651ec7b1260e29921f45">setField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field, <span class="keywordtype">float</span> value)</div>
+<div class="line"><a name="l00505"></a><span class="lineno">  505</span>&#160;    {</div>
+<div class="line"><a name="l00506"></a><span class="lineno">  506</span>&#160;        <span class="keywordtype">char</span> valueString[20]; <span class="comment">// range is -999999000000.00000 to 999999000000.00000, so 19 + 1 for the terminator</span></div>
+<div class="line"><a name="l00507"></a><span class="lineno">  507</span>&#160;        <span class="keywordtype">int</span> status = convertFloatToChar(value, valueString);</div>
+<div class="line"><a name="l00508"></a><span class="lineno">  508</span>&#160;        <span class="keywordflow">if</span>(status != OK_SUCCESS) <span class="keywordflow">return</span> status;</div>
+<div class="line"><a name="l00509"></a><span class="lineno">  509</span>&#160;</div>
+<div class="line"><a name="l00510"></a><span class="lineno">  510</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(field, valueString);</div>
+<div class="line"><a name="l00511"></a><span class="lineno">  511</span>&#160;    };</div>
+<div class="line"><a name="l00512"></a><span class="lineno">  512</span>&#160;</div>
+<div class="line"><a name="l00544"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a46b7090f54ed4381ff825118d50db1fd">  544</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#a46b7090f54ed4381ff825118d50db1fd">setField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field, <span class="keyword">const</span> <span class="keywordtype">char</span> * value)</div>
+<div class="line"><a name="l00545"></a><span class="lineno">  545</span>&#160;    {</div>
+<div class="line"><a name="l00546"></a><span class="lineno">  546</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(field, String(value));</div>
+<div class="line"><a name="l00547"></a><span class="lineno">  547</span>&#160;    };</div>
+<div class="line"><a name="l00548"></a><span class="lineno">  548</span>&#160;</div>
+<div class="line"><a name="l00580"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a5201062087f349e50a3dda7e48312850">  580</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#a5201062087f349e50a3dda7e48312850">setField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field, String value)</div>
+<div class="line"><a name="l00581"></a><span class="lineno">  581</span>&#160;    {</div>
+<div class="line"><a name="l00582"></a><span class="lineno">  582</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l00583"></a><span class="lineno">  583</span>&#160;<span class="preprocessor">          #ifdef SPARK</span></div>
+<div class="line"><a name="l00584"></a><span class="lineno">  584</span>&#160;            Particle.publish(SPARK_PUBLISH_TOPIC, <span class="stringliteral">&quot;setField &quot;</span> + String(field) + <span class="stringliteral">&quot; to &quot;</span> + String(value), SPARK_PUBLISH_TTL, PRIVATE);</div>
+<div class="line"><a name="l00585"></a><span class="lineno">  585</span>&#160;<span class="preprocessor">          #else</span></div>
+<div class="line"><a name="l00586"></a><span class="lineno">  586</span>&#160;            Serial.print(<span class="stringliteral">&quot;ts::setField   (field: &quot;</span>); Serial.print(field); Serial.print(<span class="stringliteral">&quot; value: \&quot;&quot;</span>); Serial.print(value); Serial.println(<span class="stringliteral">&quot;\&quot;)&quot;</span>);</div>
+<div class="line"><a name="l00587"></a><span class="lineno">  587</span>&#160;<span class="preprocessor">          #endif</span></div>
+<div class="line"><a name="l00588"></a><span class="lineno">  588</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l00589"></a><span class="lineno">  589</span>&#160;        <span class="keywordflow">if</span>(field &lt; FIELDNUM_MIN || field &gt; FIELDNUM_MAX) <span class="keywordflow">return</span> ERR_INVALID_FIELD_NUM;</div>
+<div class="line"><a name="l00590"></a><span class="lineno">  590</span>&#160;        <span class="comment">// Max # bytes for ThingSpeak field is 255 (UTF-8)</span></div>
+<div class="line"><a name="l00591"></a><span class="lineno">  591</span>&#160;        <span class="keywordflow">if</span>(value.length() &gt; FIELDLENGTH_MAX) <span class="keywordflow">return</span> ERR_OUT_OF_RANGE;</div>
+<div class="line"><a name="l00592"></a><span class="lineno">  592</span>&#160;        this-&gt;nextWriteField[field - 1] = value;</div>
+<div class="line"><a name="l00593"></a><span class="lineno">  593</span>&#160;        <span class="keywordflow">return</span> OK_SUCCESS;</div>
+<div class="line"><a name="l00594"></a><span class="lineno">  594</span>&#160;    };</div>
+<div class="line"><a name="l00595"></a><span class="lineno">  595</span>&#160;</div>
+<div class="line"><a name="l00596"></a><span class="lineno">  596</span>&#160;</div>
+<div class="line"><a name="l00630"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400">  630</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400">setLatitude</a>(<span class="keywordtype">float</span> latitude)</div>
+<div class="line"><a name="l00631"></a><span class="lineno">  631</span>&#160;    {</div>
+<div class="line"><a name="l00632"></a><span class="lineno">  632</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l00633"></a><span class="lineno">  633</span>&#160;            Serial.print(<span class="stringliteral">&quot;ts::setLatitude(latitude: &quot;</span>); Serial.print(latitude,3); Serial.println(<span class="stringliteral">&quot;\&quot;)&quot;</span>);</div>
+<div class="line"><a name="l00634"></a><span class="lineno">  634</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l00635"></a><span class="lineno">  635</span>&#160;        this-&gt;nextWriteLatitude = latitude;</div>
+<div class="line"><a name="l00636"></a><span class="lineno">  636</span>&#160;        <span class="keywordflow">return</span> OK_SUCCESS;</div>
+<div class="line"><a name="l00637"></a><span class="lineno">  637</span>&#160;    };</div>
+<div class="line"><a name="l00638"></a><span class="lineno">  638</span>&#160;</div>
+<div class="line"><a name="l00639"></a><span class="lineno">  639</span>&#160;</div>
+<div class="line"><a name="l00673"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e">  673</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e">setLongitude</a>(<span class="keywordtype">float</span> longitude)</div>
+<div class="line"><a name="l00674"></a><span class="lineno">  674</span>&#160;    {</div>
+<div class="line"><a name="l00675"></a><span class="lineno">  675</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l00676"></a><span class="lineno">  676</span>&#160;            Serial.print(<span class="stringliteral">&quot;ts::setLongitude(longitude: &quot;</span>); Serial.print(longitude,3); Serial.println(<span class="stringliteral">&quot;\&quot;)&quot;</span>);</div>
+<div class="line"><a name="l00677"></a><span class="lineno">  677</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l00678"></a><span class="lineno">  678</span>&#160;        this-&gt;nextWriteLongitude = longitude;</div>
+<div class="line"><a name="l00679"></a><span class="lineno">  679</span>&#160;        <span class="keywordflow">return</span> OK_SUCCESS;</div>
+<div class="line"><a name="l00680"></a><span class="lineno">  680</span>&#160;    };</div>
+<div class="line"><a name="l00681"></a><span class="lineno">  681</span>&#160;</div>
+<div class="line"><a name="l00682"></a><span class="lineno">  682</span>&#160;</div>
+<div class="line"><a name="l00716"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9">  716</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9">setElevation</a>(<span class="keywordtype">float</span> elevation)</div>
+<div class="line"><a name="l00717"></a><span class="lineno">  717</span>&#160;    {</div>
+<div class="line"><a name="l00718"></a><span class="lineno">  718</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l00719"></a><span class="lineno">  719</span>&#160;            Serial.print(<span class="stringliteral">&quot;ts::setElevation(elevation: &quot;</span>); Serial.print(elevation,3); Serial.println(<span class="stringliteral">&quot;\&quot;)&quot;</span>);</div>
+<div class="line"><a name="l00720"></a><span class="lineno">  720</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l00721"></a><span class="lineno">  721</span>&#160;        this-&gt;nextWriteElevation = elevation;</div>
+<div class="line"><a name="l00722"></a><span class="lineno">  722</span>&#160;        <span class="keywordflow">return</span> OK_SUCCESS;</div>
+<div class="line"><a name="l00723"></a><span class="lineno">  723</span>&#160;    };</div>
+<div class="line"><a name="l00724"></a><span class="lineno">  724</span>&#160;</div>
+<div class="line"><a name="l00725"></a><span class="lineno">  725</span>&#160;</div>
+<div class="line"><a name="l00760"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">  760</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, <span class="keyword">const</span> <span class="keywordtype">char</span> * writeAPIKey)</div>
+<div class="line"><a name="l00761"></a><span class="lineno">  761</span>&#160;    {</div>
+<div class="line"><a name="l00762"></a><span class="lineno">  762</span>&#160;        String postMessage = String(<span class="stringliteral">&quot;&quot;</span>);</div>
+<div class="line"><a name="l00763"></a><span class="lineno">  763</span>&#160;        <span class="keywordtype">bool</span> fFirstItem = <span class="keyword">true</span>;</div>
+<div class="line"><a name="l00764"></a><span class="lineno">  764</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> iField = 0; iField &lt; 8; iField++)</div>
+<div class="line"><a name="l00765"></a><span class="lineno">  765</span>&#160;        {</div>
+<div class="line"><a name="l00766"></a><span class="lineno">  766</span>&#160;            <span class="keywordflow">if</span>(this-&gt;nextWriteField[iField].length() &gt; 0)</div>
+<div class="line"><a name="l00767"></a><span class="lineno">  767</span>&#160;            {</div>
+<div class="line"><a name="l00768"></a><span class="lineno">  768</span>&#160;                <span class="keywordflow">if</span>(!fFirstItem)</div>
+<div class="line"><a name="l00769"></a><span class="lineno">  769</span>&#160;                {</div>
+<div class="line"><a name="l00770"></a><span class="lineno">  770</span>&#160;                    postMessage = postMessage + String(<span class="stringliteral">&quot;&amp;&quot;</span>);</div>
+<div class="line"><a name="l00771"></a><span class="lineno">  771</span>&#160;                }</div>
+<div class="line"><a name="l00772"></a><span class="lineno">  772</span>&#160;                postMessage = postMessage + String(<span class="stringliteral">&quot;field&quot;</span>) + String(iField + 1) + String(<span class="stringliteral">&quot;=&quot;</span>) + this-&gt;nextWriteField[iField];</div>
+<div class="line"><a name="l00773"></a><span class="lineno">  773</span>&#160;                fFirstItem = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l00774"></a><span class="lineno">  774</span>&#160;                this-&gt;nextWriteField[iField] = <span class="stringliteral">&quot;&quot;</span>;</div>
+<div class="line"><a name="l00775"></a><span class="lineno">  775</span>&#160;            }</div>
+<div class="line"><a name="l00776"></a><span class="lineno">  776</span>&#160;        }</div>
+<div class="line"><a name="l00777"></a><span class="lineno">  777</span>&#160;</div>
+<div class="line"><a name="l00778"></a><span class="lineno">  778</span>&#160;        <span class="keywordflow">if</span>(!isnan(nextWriteLatitude))</div>
+<div class="line"><a name="l00779"></a><span class="lineno">  779</span>&#160;        {</div>
+<div class="line"><a name="l00780"></a><span class="lineno">  780</span>&#160;            <span class="keywordflow">if</span>(!fFirstItem)</div>
+<div class="line"><a name="l00781"></a><span class="lineno">  781</span>&#160;            {</div>
+<div class="line"><a name="l00782"></a><span class="lineno">  782</span>&#160;                postMessage = postMessage + String(<span class="stringliteral">&quot;&amp;&quot;</span>);</div>
+<div class="line"><a name="l00783"></a><span class="lineno">  783</span>&#160;            }</div>
+<div class="line"><a name="l00784"></a><span class="lineno">  784</span>&#160;            postMessage = postMessage + String(<span class="stringliteral">&quot;lat=&quot;</span>) + String(this-&gt;nextWriteLatitude);</div>
+<div class="line"><a name="l00785"></a><span class="lineno">  785</span>&#160;            fFirstItem = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l00786"></a><span class="lineno">  786</span>&#160;            this-&gt;nextWriteLatitude = NAN;</div>
+<div class="line"><a name="l00787"></a><span class="lineno">  787</span>&#160;        }</div>
+<div class="line"><a name="l00788"></a><span class="lineno">  788</span>&#160;</div>
+<div class="line"><a name="l00789"></a><span class="lineno">  789</span>&#160;        <span class="keywordflow">if</span>(!isnan(this-&gt;nextWriteLongitude))</div>
+<div class="line"><a name="l00790"></a><span class="lineno">  790</span>&#160;        {</div>
+<div class="line"><a name="l00791"></a><span class="lineno">  791</span>&#160;            <span class="keywordflow">if</span>(!fFirstItem)</div>
+<div class="line"><a name="l00792"></a><span class="lineno">  792</span>&#160;            {</div>
+<div class="line"><a name="l00793"></a><span class="lineno">  793</span>&#160;                postMessage = postMessage + String(<span class="stringliteral">&quot;&amp;&quot;</span>);</div>
+<div class="line"><a name="l00794"></a><span class="lineno">  794</span>&#160;            }</div>
+<div class="line"><a name="l00795"></a><span class="lineno">  795</span>&#160;            postMessage = postMessage + String(<span class="stringliteral">&quot;long=&quot;</span>) + String(this-&gt;nextWriteLongitude);</div>
+<div class="line"><a name="l00796"></a><span class="lineno">  796</span>&#160;            fFirstItem = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l00797"></a><span class="lineno">  797</span>&#160;            this-&gt;nextWriteLongitude = NAN;</div>
+<div class="line"><a name="l00798"></a><span class="lineno">  798</span>&#160;        }</div>
+<div class="line"><a name="l00799"></a><span class="lineno">  799</span>&#160;</div>
+<div class="line"><a name="l00800"></a><span class="lineno">  800</span>&#160;</div>
+<div class="line"><a name="l00801"></a><span class="lineno">  801</span>&#160;        <span class="keywordflow">if</span>(!isnan(this-&gt;nextWriteElevation))</div>
+<div class="line"><a name="l00802"></a><span class="lineno">  802</span>&#160;        {</div>
+<div class="line"><a name="l00803"></a><span class="lineno">  803</span>&#160;            <span class="keywordflow">if</span>(!fFirstItem)</div>
+<div class="line"><a name="l00804"></a><span class="lineno">  804</span>&#160;            {</div>
+<div class="line"><a name="l00805"></a><span class="lineno">  805</span>&#160;                postMessage = postMessage + String(<span class="stringliteral">&quot;&amp;&quot;</span>);</div>
+<div class="line"><a name="l00806"></a><span class="lineno">  806</span>&#160;            }</div>
+<div class="line"><a name="l00807"></a><span class="lineno">  807</span>&#160;            postMessage = postMessage + String(<span class="stringliteral">&quot;elevation=&quot;</span>) + String(this-&gt;nextWriteElevation);</div>
+<div class="line"><a name="l00808"></a><span class="lineno">  808</span>&#160;            fFirstItem = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l00809"></a><span class="lineno">  809</span>&#160;            this-&gt;nextWriteElevation = NAN;</div>
+<div class="line"><a name="l00810"></a><span class="lineno">  810</span>&#160;        }</div>
+<div class="line"><a name="l00811"></a><span class="lineno">  811</span>&#160;</div>
+<div class="line"><a name="l00812"></a><span class="lineno">  812</span>&#160;        <span class="keywordflow">if</span>(fFirstItem)</div>
+<div class="line"><a name="l00813"></a><span class="lineno">  813</span>&#160;        {</div>
+<div class="line"><a name="l00814"></a><span class="lineno">  814</span>&#160;            <span class="comment">// setField was not called before writeFields</span></div>
+<div class="line"><a name="l00815"></a><span class="lineno">  815</span>&#160;            <span class="keywordflow">return</span> ERR_SETFIELD_NOT_CALLED;</div>
+<div class="line"><a name="l00816"></a><span class="lineno">  816</span>&#160;        }</div>
+<div class="line"><a name="l00817"></a><span class="lineno">  817</span>&#160;</div>
+<div class="line"><a name="l00818"></a><span class="lineno">  818</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#a2a5333f683802cb455a3713d604abb84">writeRaw</a>(channelNumber, postMessage, writeAPIKey);</div>
+<div class="line"><a name="l00819"></a><span class="lineno">  819</span>&#160;    };</div>
+<div class="line"><a name="l00820"></a><span class="lineno">  820</span>&#160;</div>
+<div class="line"><a name="l00821"></a><span class="lineno">  821</span>&#160;</div>
+<div class="line"><a name="l00842"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a2a5333f683802cb455a3713d604abb84">  842</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#a2a5333f683802cb455a3713d604abb84">writeRaw</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, <span class="keyword">const</span> <span class="keywordtype">char</span> * postMessage, <span class="keyword">const</span> <span class="keywordtype">char</span> * writeAPIKey)</div>
+<div class="line"><a name="l00843"></a><span class="lineno">  843</span>&#160;    {</div>
+<div class="line"><a name="l00844"></a><span class="lineno">  844</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#a2a5333f683802cb455a3713d604abb84">writeRaw</a>(channelNumber, String(postMessage), writeAPIKey);</div>
+<div class="line"><a name="l00845"></a><span class="lineno">  845</span>&#160;    };</div>
+<div class="line"><a name="l00846"></a><span class="lineno">  846</span>&#160;</div>
+<div class="line"><a name="l00847"></a><span class="lineno">  847</span>&#160;</div>
+<div class="line"><a name="l00863"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a7c3415bd86e0fa2c335d3b245912fb55">  863</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#a7c3415bd86e0fa2c335d3b245912fb55">writeRaw</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, String postMessage, <span class="keyword">const</span> <span class="keywordtype">char</span> * writeAPIKey)</div>
+<div class="line"><a name="l00864"></a><span class="lineno">  864</span>&#160;    {</div>
+<div class="line"><a name="l00865"></a><span class="lineno">  865</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l00866"></a><span class="lineno">  866</span>&#160;            Serial.print(<span class="stringliteral">&quot;ts::writeRaw   (channelNumber: &quot;</span>); Serial.print(channelNumber); Serial.print(<span class="stringliteral">&quot; writeAPIKey: &quot;</span>); Serial.print(writeAPIKey); Serial.print(<span class="stringliteral">&quot; postMessage: \&quot;&quot;</span>); Serial.print(postMessage); Serial.println(<span class="stringliteral">&quot;\&quot;)&quot;</span>);</div>
+<div class="line"><a name="l00867"></a><span class="lineno">  867</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l00868"></a><span class="lineno">  868</span>&#160;</div>
+<div class="line"><a name="l00869"></a><span class="lineno">  869</span>&#160;        <span class="keywordflow">if</span>(!connectThingSpeak())</div>
+<div class="line"><a name="l00870"></a><span class="lineno">  870</span>&#160;        {</div>
+<div class="line"><a name="l00871"></a><span class="lineno">  871</span>&#160;            <span class="comment">// Failed to connect to ThingSpeak</span></div>
+<div class="line"><a name="l00872"></a><span class="lineno">  872</span>&#160;            <span class="keywordflow">return</span> ERR_CONNECT_FAILED;</div>
+<div class="line"><a name="l00873"></a><span class="lineno">  873</span>&#160;        }</div>
+<div class="line"><a name="l00874"></a><span class="lineno">  874</span>&#160;</div>
+<div class="line"><a name="l00875"></a><span class="lineno">  875</span>&#160;        postMessage = postMessage + String(<span class="stringliteral">&quot;&amp;headers=false&quot;</span>);</div>
+<div class="line"><a name="l00876"></a><span class="lineno">  876</span>&#160;</div>
+<div class="line"><a name="l00877"></a><span class="lineno">  877</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l00878"></a><span class="lineno">  878</span>&#160;<span class="preprocessor">          #ifdef SPARK</span></div>
+<div class="line"><a name="l00879"></a><span class="lineno">  879</span>&#160;            Particle.publish(SPARK_PUBLISH_TOPIC, <span class="stringliteral">&quot;Post &quot;</span> + postMessage, SPARK_PUBLISH_TTL, PRIVATE);</div>
+<div class="line"><a name="l00880"></a><span class="lineno">  880</span>&#160;<span class="preprocessor">          #else</span></div>
+<div class="line"><a name="l00881"></a><span class="lineno">  881</span>&#160;            Serial.print(<span class="stringliteral">&quot;               POST \&quot;&quot;</span>);Serial.print(postMessage);Serial.println(<span class="stringliteral">&quot;\&quot;&quot;</span>);</div>
+<div class="line"><a name="l00882"></a><span class="lineno">  882</span>&#160;<span class="preprocessor">          #endif</span></div>
+<div class="line"><a name="l00883"></a><span class="lineno">  883</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l00884"></a><span class="lineno">  884</span>&#160;</div>
+<div class="line"><a name="l00885"></a><span class="lineno">  885</span>&#160;        postMessage = postMessage + String(<span class="stringliteral">&quot;\n&quot;</span>);</div>
+<div class="line"><a name="l00886"></a><span class="lineno">  886</span>&#160;</div>
+<div class="line"><a name="l00887"></a><span class="lineno">  887</span>&#160;        <span class="comment">// Post data to thingspeak</span></div>
+<div class="line"><a name="l00888"></a><span class="lineno">  888</span>&#160;        <span class="keywordflow">if</span>(!this-&gt;client-&gt;print(<span class="stringliteral">&quot;POST /update HTTP/1.1\n&quot;</span>)) <span class="keywordflow">return</span> abortWriteRaw();</div>
+<div class="line"><a name="l00889"></a><span class="lineno">  889</span>&#160;        <span class="keywordflow">if</span>(!writeHTTPHeader(writeAPIKey)) <span class="keywordflow">return</span> abortWriteRaw();</div>
+<div class="line"><a name="l00890"></a><span class="lineno">  890</span>&#160;        <span class="keywordflow">if</span>(!this-&gt;client-&gt;print(<span class="stringliteral">&quot;Content-Type: application/x-www-form-urlencoded\n&quot;</span>)) <span class="keywordflow">return</span> abortWriteRaw();</div>
+<div class="line"><a name="l00891"></a><span class="lineno">  891</span>&#160;        <span class="keywordflow">if</span>(!this-&gt;client-&gt;print(<span class="stringliteral">&quot;Content-Length: &quot;</span>)) <span class="keywordflow">return</span> abortWriteRaw();</div>
+<div class="line"><a name="l00892"></a><span class="lineno">  892</span>&#160;        <span class="keywordflow">if</span>(!this-&gt;client-&gt;print(postMessage.length())) <span class="keywordflow">return</span> abortWriteRaw();</div>
+<div class="line"><a name="l00893"></a><span class="lineno">  893</span>&#160;        <span class="keywordflow">if</span>(!this-&gt;client-&gt;print(<span class="stringliteral">&quot;\n\n&quot;</span>)) <span class="keywordflow">return</span> abortWriteRaw();</div>
+<div class="line"><a name="l00894"></a><span class="lineno">  894</span>&#160;        <span class="keywordflow">if</span>(!this-&gt;client-&gt;print(postMessage)) <span class="keywordflow">return</span> abortWriteRaw();</div>
+<div class="line"><a name="l00895"></a><span class="lineno">  895</span>&#160;  </div>
+<div class="line"><a name="l00896"></a><span class="lineno">  896</span>&#160;        String entryIDText = String();</div>
+<div class="line"><a name="l00897"></a><span class="lineno">  897</span>&#160;        <span class="keywordtype">int</span> status = getHTTPResponse(entryIDText);</div>
+<div class="line"><a name="l00898"></a><span class="lineno">  898</span>&#160;        <span class="keywordflow">if</span>(status != OK_SUCCESS)</div>
+<div class="line"><a name="l00899"></a><span class="lineno">  899</span>&#160;        {</div>
+<div class="line"><a name="l00900"></a><span class="lineno">  900</span>&#160;            client-&gt;stop();</div>
+<div class="line"><a name="l00901"></a><span class="lineno">  901</span>&#160;            <span class="keywordflow">return</span> status;</div>
+<div class="line"><a name="l00902"></a><span class="lineno">  902</span>&#160;        }</div>
+<div class="line"><a name="l00903"></a><span class="lineno">  903</span>&#160;        <span class="keywordtype">long</span> entryID = entryIDText.toInt();</div>
+<div class="line"><a name="l00904"></a><span class="lineno">  904</span>&#160;</div>
+<div class="line"><a name="l00905"></a><span class="lineno">  905</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l00906"></a><span class="lineno">  906</span>&#160;        Serial.print(<span class="stringliteral">&quot;               Entry ID \&quot;&quot;</span>);Serial.print(entryIDText);Serial.print(<span class="stringliteral">&quot;\&quot; (&quot;</span>);Serial.print(entryID);Serial.println(<span class="stringliteral">&quot;)&quot;</span>);</div>
+<div class="line"><a name="l00907"></a><span class="lineno">  907</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l00908"></a><span class="lineno">  908</span>&#160;</div>
+<div class="line"><a name="l00909"></a><span class="lineno">  909</span>&#160;        client-&gt;stop();</div>
+<div class="line"><a name="l00910"></a><span class="lineno">  910</span>&#160;        </div>
+<div class="line"><a name="l00911"></a><span class="lineno">  911</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l00912"></a><span class="lineno">  912</span>&#160;            Serial.println(<span class="stringliteral">&quot;disconnected.&quot;</span>);</div>
+<div class="line"><a name="l00913"></a><span class="lineno">  913</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l00914"></a><span class="lineno">  914</span>&#160;        <span class="keywordflow">if</span>(entryID == 0)</div>
+<div class="line"><a name="l00915"></a><span class="lineno">  915</span>&#160;        {</div>
+<div class="line"><a name="l00916"></a><span class="lineno">  916</span>&#160;            <span class="comment">// ThingSpeak did not accept the write</span></div>
+<div class="line"><a name="l00917"></a><span class="lineno">  917</span>&#160;            status = ERR_NOT_INSERTED;</div>
+<div class="line"><a name="l00918"></a><span class="lineno">  918</span>&#160;        }</div>
+<div class="line"><a name="l00919"></a><span class="lineno">  919</span>&#160;        <span class="keywordflow">return</span> status;</div>
+<div class="line"><a name="l00920"></a><span class="lineno">  920</span>&#160;    };</div>
+<div class="line"><a name="l00921"></a><span class="lineno">  921</span>&#160;    </div>
+<div class="line"><a name="l00937"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#aa1534ea566b7f9fc951a41f8cf41f53b">  937</a></span>&#160;    String <a class="code" href="class_thing_speak_class.html#aa1534ea566b7f9fc951a41f8cf41f53b">readStringField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field, <span class="keyword">const</span> <span class="keywordtype">char</span> * readAPIKey)</div>
+<div class="line"><a name="l00938"></a><span class="lineno">  938</span>&#160;    {</div>
+<div class="line"><a name="l00939"></a><span class="lineno">  939</span>&#160;        <span class="keywordflow">if</span>(field &lt; FIELDNUM_MIN || field &gt; FIELDNUM_MAX)</div>
+<div class="line"><a name="l00940"></a><span class="lineno">  940</span>&#160;        {</div>
+<div class="line"><a name="l00941"></a><span class="lineno">  941</span>&#160;            this-&gt;lastReadStatus = ERR_INVALID_FIELD_NUM;</div>
+<div class="line"><a name="l00942"></a><span class="lineno">  942</span>&#160;            <span class="keywordflow">return</span>(<span class="stringliteral">&quot;&quot;</span>);</div>
+<div class="line"><a name="l00943"></a><span class="lineno">  943</span>&#160;        }</div>
+<div class="line"><a name="l00944"></a><span class="lineno">  944</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l00945"></a><span class="lineno">  945</span>&#160;            Serial.print(<span class="stringliteral">&quot;ts::readStringField(channelNumber: &quot;</span>); Serial.print(channelNumber); </div>
+<div class="line"><a name="l00946"></a><span class="lineno">  946</span>&#160;            <span class="keywordflow">if</span>(NULL != readAPIKey)</div>
+<div class="line"><a name="l00947"></a><span class="lineno">  947</span>&#160;            {</div>
+<div class="line"><a name="l00948"></a><span class="lineno">  948</span>&#160;                Serial.print(<span class="stringliteral">&quot; readAPIKey: &quot;</span>); Serial.print(readAPIKey);</div>
+<div class="line"><a name="l00949"></a><span class="lineno">  949</span>&#160;            }</div>
+<div class="line"><a name="l00950"></a><span class="lineno">  950</span>&#160;            Serial.print(<span class="stringliteral">&quot; field: &quot;</span>); Serial.print(field); Serial.println(<span class="stringliteral">&quot;)&quot;</span>);</div>
+<div class="line"><a name="l00951"></a><span class="lineno">  951</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l00952"></a><span class="lineno">  952</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#a578758c62a821dc9197ec6a3fdc0f7bc">readRaw</a>(channelNumber, String(String(<span class="stringliteral">&quot;/fields/&quot;</span>) + String(field) + String(<span class="stringliteral">&quot;/last&quot;</span>)), readAPIKey);</div>
+<div class="line"><a name="l00953"></a><span class="lineno">  953</span>&#160;    }</div>
+<div class="line"><a name="l00954"></a><span class="lineno">  954</span>&#160;</div>
+<div class="line"><a name="l00955"></a><span class="lineno">  955</span>&#160;</div>
+<div class="line"><a name="l00970"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a7ed5914c2f5c7d84672cdaae3547da96">  970</a></span>&#160;    String <a class="code" href="class_thing_speak_class.html#a7ed5914c2f5c7d84672cdaae3547da96">readStringField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field)</div>
+<div class="line"><a name="l00971"></a><span class="lineno">  971</span>&#160;    {</div>
+<div class="line"><a name="l00972"></a><span class="lineno">  972</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#aa1534ea566b7f9fc951a41f8cf41f53b">readStringField</a>(channelNumber, field, NULL);</div>
+<div class="line"><a name="l00973"></a><span class="lineno">  973</span>&#160;    };</div>
+<div class="line"><a name="l00974"></a><span class="lineno">  974</span>&#160;</div>
+<div class="line"><a name="l00975"></a><span class="lineno">  975</span>&#160;</div>
+<div class="line"><a name="l00992"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a02cd79a65f1229711801fac5aec158b4">  992</a></span>&#160;    <span class="keywordtype">float</span> <a class="code" href="class_thing_speak_class.html#a02cd79a65f1229711801fac5aec158b4">readFloatField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field, <span class="keyword">const</span> <span class="keywordtype">char</span> * readAPIKey)</div>
+<div class="line"><a name="l00993"></a><span class="lineno">  993</span>&#160;    {</div>
+<div class="line"><a name="l00994"></a><span class="lineno">  994</span>&#160;        <span class="keywordflow">return</span> convertStringToFloat(<a class="code" href="class_thing_speak_class.html#aa1534ea566b7f9fc951a41f8cf41f53b">readStringField</a>(channelNumber, field, readAPIKey));</div>
+<div class="line"><a name="l00995"></a><span class="lineno">  995</span>&#160;    };</div>
+<div class="line"><a name="l00996"></a><span class="lineno">  996</span>&#160;</div>
+<div class="line"><a name="l00997"></a><span class="lineno">  997</span>&#160;</div>
+<div class="line"><a name="l01013"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#ac65345864040b8f067a6d0e73a8dccfa"> 1013</a></span>&#160;    <span class="keywordtype">float</span> <a class="code" href="class_thing_speak_class.html#ac65345864040b8f067a6d0e73a8dccfa">readFloatField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field)</div>
+<div class="line"><a name="l01014"></a><span class="lineno"> 1014</span>&#160;    {</div>
+<div class="line"><a name="l01015"></a><span class="lineno"> 1015</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#a02cd79a65f1229711801fac5aec158b4">readFloatField</a>(channelNumber, field, NULL);</div>
+<div class="line"><a name="l01016"></a><span class="lineno"> 1016</span>&#160;    };</div>
+<div class="line"><a name="l01017"></a><span class="lineno"> 1017</span>&#160;</div>
+<div class="line"><a name="l01018"></a><span class="lineno"> 1018</span>&#160;</div>
+<div class="line"><a name="l01034"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#aff3c2e94e85da016fb8c82432e015d1b"> 1034</a></span>&#160;    <span class="keywordtype">long</span> <a class="code" href="class_thing_speak_class.html#aff3c2e94e85da016fb8c82432e015d1b">readLongField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field, <span class="keyword">const</span> <span class="keywordtype">char</span> * readAPIKey)</div>
+<div class="line"><a name="l01035"></a><span class="lineno"> 1035</span>&#160;    {</div>
+<div class="line"><a name="l01036"></a><span class="lineno"> 1036</span>&#160;        <span class="comment">// Note that although the function is called &quot;toInt&quot; it really returns a long.</span></div>
+<div class="line"><a name="l01037"></a><span class="lineno"> 1037</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#aa1534ea566b7f9fc951a41f8cf41f53b">readStringField</a>(channelNumber, field, readAPIKey).toInt();</div>
+<div class="line"><a name="l01038"></a><span class="lineno"> 1038</span>&#160;    }</div>
+<div class="line"><a name="l01039"></a><span class="lineno"> 1039</span>&#160;</div>
+<div class="line"><a name="l01040"></a><span class="lineno"> 1040</span>&#160;</div>
+<div class="line"><a name="l01055"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#aa1660fbf6444ca06dc744a244905f6d9"> 1055</a></span>&#160;    <span class="keywordtype">long</span> <a class="code" href="class_thing_speak_class.html#aa1660fbf6444ca06dc744a244905f6d9">readLongField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field)</div>
+<div class="line"><a name="l01056"></a><span class="lineno"> 1056</span>&#160;    {</div>
+<div class="line"><a name="l01057"></a><span class="lineno"> 1057</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#aff3c2e94e85da016fb8c82432e015d1b">readLongField</a>(channelNumber, field, NULL);</div>
+<div class="line"><a name="l01058"></a><span class="lineno"> 1058</span>&#160;    };</div>
+<div class="line"><a name="l01059"></a><span class="lineno"> 1059</span>&#160;</div>
+<div class="line"><a name="l01060"></a><span class="lineno"> 1060</span>&#160;</div>
+<div class="line"><a name="l01077"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a1241ae5b3e08b1751495f2e45dabcc46"> 1077</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#a1241ae5b3e08b1751495f2e45dabcc46">readIntField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field, <span class="keyword">const</span> <span class="keywordtype">char</span> * readAPIKey)</div>
+<div class="line"><a name="l01078"></a><span class="lineno"> 1078</span>&#160;    {</div>
+<div class="line"><a name="l01079"></a><span class="lineno"> 1079</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#aff3c2e94e85da016fb8c82432e015d1b">readLongField</a>(channelNumber, field, readAPIKey);</div>
+<div class="line"><a name="l01080"></a><span class="lineno"> 1080</span>&#160;    }</div>
+<div class="line"><a name="l01081"></a><span class="lineno"> 1081</span>&#160;</div>
+<div class="line"><a name="l01082"></a><span class="lineno"> 1082</span>&#160;</div>
+<div class="line"><a name="l01098"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#adb2ba704f38e591a6a391f7aa1850818"> 1098</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#adb2ba704f38e591a6a391f7aa1850818">readIntField</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> field)</div>
+<div class="line"><a name="l01099"></a><span class="lineno"> 1099</span>&#160;    {</div>
+<div class="line"><a name="l01100"></a><span class="lineno"> 1100</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#aff3c2e94e85da016fb8c82432e015d1b">readLongField</a>(channelNumber, field, NULL);</div>
+<div class="line"><a name="l01101"></a><span class="lineno"> 1101</span>&#160;    };</div>
+<div class="line"><a name="l01102"></a><span class="lineno"> 1102</span>&#160;    </div>
+<div class="line"><a name="l01118"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a578758c62a821dc9197ec6a3fdc0f7bc"> 1118</a></span>&#160;    String <a class="code" href="class_thing_speak_class.html#a578758c62a821dc9197ec6a3fdc0f7bc">readRaw</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, String URLSuffix)</div>
+<div class="line"><a name="l01119"></a><span class="lineno"> 1119</span>&#160;    {</div>
+<div class="line"><a name="l01120"></a><span class="lineno"> 1120</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_thing_speak_class.html#a578758c62a821dc9197ec6a3fdc0f7bc">readRaw</a>(channelNumber, URLSuffix, NULL);</div>
+<div class="line"><a name="l01121"></a><span class="lineno"> 1121</span>&#160;    }</div>
+<div class="line"><a name="l01122"></a><span class="lineno"> 1122</span>&#160;    </div>
+<div class="line"><a name="l01139"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#abffced4cce37008c03c32d3feb38861d"> 1139</a></span>&#160;    String <a class="code" href="class_thing_speak_class.html#abffced4cce37008c03c32d3feb38861d">readRaw</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> channelNumber, String URLSuffix, <span class="keyword">const</span> <span class="keywordtype">char</span> * readAPIKey)</div>
+<div class="line"><a name="l01140"></a><span class="lineno"> 1140</span>&#160;    {</div>
+<div class="line"><a name="l01141"></a><span class="lineno"> 1141</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l01142"></a><span class="lineno"> 1142</span>&#160;            Serial.print(<span class="stringliteral">&quot;ts::readRaw   (channelNumber: &quot;</span>); Serial.print(channelNumber);</div>
+<div class="line"><a name="l01143"></a><span class="lineno"> 1143</span>&#160;            <span class="keywordflow">if</span>(NULL != readAPIKey)</div>
+<div class="line"><a name="l01144"></a><span class="lineno"> 1144</span>&#160;            {</div>
+<div class="line"><a name="l01145"></a><span class="lineno"> 1145</span>&#160;                Serial.print(<span class="stringliteral">&quot; readAPIKey: &quot;</span>); Serial.print(readAPIKey);</div>
+<div class="line"><a name="l01146"></a><span class="lineno"> 1146</span>&#160;            }</div>
+<div class="line"><a name="l01147"></a><span class="lineno"> 1147</span>&#160;            Serial.print(<span class="stringliteral">&quot; URLSuffix: \&quot;&quot;</span>); Serial.print(URLSuffix); Serial.println(<span class="stringliteral">&quot;\&quot;)&quot;</span>);</div>
+<div class="line"><a name="l01148"></a><span class="lineno"> 1148</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l01149"></a><span class="lineno"> 1149</span>&#160;</div>
+<div class="line"><a name="l01150"></a><span class="lineno"> 1150</span>&#160;        <span class="keywordflow">if</span>(!connectThingSpeak())</div>
+<div class="line"><a name="l01151"></a><span class="lineno"> 1151</span>&#160;        {</div>
+<div class="line"><a name="l01152"></a><span class="lineno"> 1152</span>&#160;            this-&gt;lastReadStatus = ERR_CONNECT_FAILED;</div>
+<div class="line"><a name="l01153"></a><span class="lineno"> 1153</span>&#160;            <span class="keywordflow">return</span> String(<span class="stringliteral">&quot;&quot;</span>);</div>
+<div class="line"><a name="l01154"></a><span class="lineno"> 1154</span>&#160;        }</div>
+<div class="line"><a name="l01155"></a><span class="lineno"> 1155</span>&#160;</div>
+<div class="line"><a name="l01156"></a><span class="lineno"> 1156</span>&#160;        String URL = String(<span class="stringliteral">&quot;/channels/&quot;</span>) + String(channelNumber) + URLSuffix;</div>
+<div class="line"><a name="l01157"></a><span class="lineno"> 1157</span>&#160;</div>
+<div class="line"><a name="l01158"></a><span class="lineno"> 1158</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l01159"></a><span class="lineno"> 1159</span>&#160;            Serial.print(<span class="stringliteral">&quot;               GET \&quot;&quot;</span>);Serial.print(URL);Serial.println(<span class="stringliteral">&quot;\&quot;&quot;</span>);</div>
+<div class="line"><a name="l01160"></a><span class="lineno"> 1160</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l01161"></a><span class="lineno"> 1161</span>&#160;</div>
+<div class="line"><a name="l01162"></a><span class="lineno"> 1162</span>&#160;        <span class="comment">// Post data to thingspeak</span></div>
+<div class="line"><a name="l01163"></a><span class="lineno"> 1163</span>&#160;        <span class="keywordflow">if</span>(!this-&gt;client-&gt;print(<span class="stringliteral">&quot;GET &quot;</span>)) <span class="keywordflow">return</span> abortReadRaw();</div>
+<div class="line"><a name="l01164"></a><span class="lineno"> 1164</span>&#160;        <span class="keywordflow">if</span>(!this-&gt;client-&gt;print(URL)) <span class="keywordflow">return</span> abortReadRaw();</div>
+<div class="line"><a name="l01165"></a><span class="lineno"> 1165</span>&#160;        <span class="keywordflow">if</span>(!this-&gt;client-&gt;print(<span class="stringliteral">&quot; HTTP/1.1\n&quot;</span>)) <span class="keywordflow">return</span> abortReadRaw();</div>
+<div class="line"><a name="l01166"></a><span class="lineno"> 1166</span>&#160;        <span class="keywordflow">if</span>(!writeHTTPHeader(readAPIKey)) <span class="keywordflow">return</span> abortReadRaw();</div>
+<div class="line"><a name="l01167"></a><span class="lineno"> 1167</span>&#160;        <span class="keywordflow">if</span>(!this-&gt;client-&gt;print(<span class="stringliteral">&quot;\n&quot;</span>)) <span class="keywordflow">return</span> abortReadRaw();</div>
+<div class="line"><a name="l01168"></a><span class="lineno"> 1168</span>&#160; </div>
+<div class="line"><a name="l01169"></a><span class="lineno"> 1169</span>&#160;        String content = String();</div>
+<div class="line"><a name="l01170"></a><span class="lineno"> 1170</span>&#160;        <span class="keywordtype">int</span> status = getHTTPResponse(content);</div>
+<div class="line"><a name="l01171"></a><span class="lineno"> 1171</span>&#160;        this-&gt;lastReadStatus = status;</div>
+<div class="line"><a name="l01172"></a><span class="lineno"> 1172</span>&#160;</div>
+<div class="line"><a name="l01173"></a><span class="lineno"> 1173</span>&#160;</div>
+<div class="line"><a name="l01174"></a><span class="lineno"> 1174</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l01175"></a><span class="lineno"> 1175</span>&#160;            <span class="keywordflow">if</span>(status == OK_SUCCESS)</div>
+<div class="line"><a name="l01176"></a><span class="lineno"> 1176</span>&#160;            {</div>
+<div class="line"><a name="l01177"></a><span class="lineno"> 1177</span>&#160;                Serial.print(<span class="stringliteral">&quot;Read: \&quot;&quot;</span>); Serial.print(content); Serial.println(<span class="stringliteral">&quot;\&quot;&quot;</span>);</div>
+<div class="line"><a name="l01178"></a><span class="lineno"> 1178</span>&#160;            }</div>
+<div class="line"><a name="l01179"></a><span class="lineno"> 1179</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l01180"></a><span class="lineno"> 1180</span>&#160;</div>
+<div class="line"><a name="l01181"></a><span class="lineno"> 1181</span>&#160;        client-&gt;stop();</div>
+<div class="line"><a name="l01182"></a><span class="lineno"> 1182</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l01183"></a><span class="lineno"> 1183</span>&#160;            Serial.println(<span class="stringliteral">&quot;disconnected.&quot;</span>);</div>
+<div class="line"><a name="l01184"></a><span class="lineno"> 1184</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l01185"></a><span class="lineno"> 1185</span>&#160;</div>
+<div class="line"><a name="l01186"></a><span class="lineno"> 1186</span>&#160;        <span class="keywordflow">if</span>(status != OK_SUCCESS)</div>
+<div class="line"><a name="l01187"></a><span class="lineno"> 1187</span>&#160;        {</div>
+<div class="line"><a name="l01188"></a><span class="lineno"> 1188</span>&#160;            <span class="comment">// return status;</span></div>
+<div class="line"><a name="l01189"></a><span class="lineno"> 1189</span>&#160;            <span class="keywordflow">return</span> String(<span class="stringliteral">&quot;&quot;</span>);</div>
+<div class="line"><a name="l01190"></a><span class="lineno"> 1190</span>&#160;        }</div>
+<div class="line"><a name="l01191"></a><span class="lineno"> 1191</span>&#160;</div>
+<div class="line"><a name="l01192"></a><span class="lineno"> 1192</span>&#160;        <span class="comment">// This is a workaround to a bug in the Spark implementation of String</span></div>
+<div class="line"><a name="l01193"></a><span class="lineno"> 1193</span>&#160;        <span class="keywordflow">return</span> String(<span class="stringliteral">&quot;&quot;</span>) + content;</div>
+<div class="line"><a name="l01194"></a><span class="lineno"> 1194</span>&#160;    };</div>
+<div class="line"><a name="l01195"></a><span class="lineno"> 1195</span>&#160;    </div>
+<div class="line"><a name="l01229"></a><span class="lineno"><a class="line" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577"> 1229</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577">getLastReadStatus</a>()</div>
+<div class="line"><a name="l01230"></a><span class="lineno"> 1230</span>&#160;    {</div>
+<div class="line"><a name="l01231"></a><span class="lineno"> 1231</span>&#160;        <span class="keywordflow">return</span> this-&gt;lastReadStatus;</div>
+<div class="line"><a name="l01232"></a><span class="lineno"> 1232</span>&#160;    };</div>
+<div class="line"><a name="l01233"></a><span class="lineno"> 1233</span>&#160;<span class="keyword">private</span>:</div>
+<div class="line"><a name="l01234"></a><span class="lineno"> 1234</span>&#160;</div>
+<div class="line"><a name="l01235"></a><span class="lineno"> 1235</span>&#160;    <span class="keywordtype">int</span> abortWriteRaw()</div>
+<div class="line"><a name="l01236"></a><span class="lineno"> 1236</span>&#160;    {</div>
+<div class="line"><a name="l01237"></a><span class="lineno"> 1237</span>&#160;        this-&gt;client-&gt;stop();</div>
+<div class="line"><a name="l01238"></a><span class="lineno"> 1238</span>&#160;        <span class="keywordflow">return</span> ERR_UNEXPECTED_FAIL;</div>
+<div class="line"><a name="l01239"></a><span class="lineno"> 1239</span>&#160;    }</div>
+<div class="line"><a name="l01240"></a><span class="lineno"> 1240</span>&#160;</div>
+<div class="line"><a name="l01241"></a><span class="lineno"> 1241</span>&#160;    String abortReadRaw()</div>
+<div class="line"><a name="l01242"></a><span class="lineno"> 1242</span>&#160;    {</div>
+<div class="line"><a name="l01243"></a><span class="lineno"> 1243</span>&#160;        this-&gt;client-&gt;stop();</div>
+<div class="line"><a name="l01244"></a><span class="lineno"> 1244</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l01245"></a><span class="lineno"> 1245</span>&#160;            Serial.println(<span class="stringliteral">&quot;ReadRaw abort - disconnected.&quot;</span>);</div>
+<div class="line"><a name="l01246"></a><span class="lineno"> 1246</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l01247"></a><span class="lineno"> 1247</span>&#160;        this-&gt;lastReadStatus = ERR_UNEXPECTED_FAIL;</div>
+<div class="line"><a name="l01248"></a><span class="lineno"> 1248</span>&#160;        <span class="keywordflow">return</span> String(<span class="stringliteral">&quot;&quot;</span>);</div>
+<div class="line"><a name="l01249"></a><span class="lineno"> 1249</span>&#160;    }</div>
+<div class="line"><a name="l01250"></a><span class="lineno"> 1250</span>&#160;</div>
+<div class="line"><a name="l01251"></a><span class="lineno"> 1251</span>&#160;    <span class="keywordtype">void</span> setServer(<span class="keyword">const</span> <span class="keywordtype">char</span> * customHostName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> port)</div>
+<div class="line"><a name="l01252"></a><span class="lineno"> 1252</span>&#160;    {</div>
+<div class="line"><a name="l01253"></a><span class="lineno"> 1253</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l01254"></a><span class="lineno"> 1254</span>&#160;            Serial.print(<span class="stringliteral">&quot;ts::setServer  (URL: \&quot;&quot;</span>); Serial.print(customHostName); Serial.println(<span class="stringliteral">&quot;\&quot;)&quot;</span>);</div>
+<div class="line"><a name="l01255"></a><span class="lineno"> 1255</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l01256"></a><span class="lineno"> 1256</span>&#160;        this-&gt;customIP = INADDR_NONE;</div>
+<div class="line"><a name="l01257"></a><span class="lineno"> 1257</span>&#160;        this-&gt;customHostName = customHostName;</div>
+<div class="line"><a name="l01258"></a><span class="lineno"> 1258</span>&#160;        this-&gt;port = port;</div>
+<div class="line"><a name="l01259"></a><span class="lineno"> 1259</span>&#160;    };</div>
+<div class="line"><a name="l01260"></a><span class="lineno"> 1260</span>&#160;</div>
+<div class="line"><a name="l01261"></a><span class="lineno"> 1261</span>&#160;    <span class="keywordtype">void</span> setServer(IPAddress customIP, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> port)</div>
+<div class="line"><a name="l01262"></a><span class="lineno"> 1262</span>&#160;    {</div>
+<div class="line"><a name="l01263"></a><span class="lineno"> 1263</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l01264"></a><span class="lineno"> 1264</span>&#160;            Serial.print(<span class="stringliteral">&quot;ts::setServer  (IP: \&quot;&quot;</span>); Serial.print(customIP); Serial.println(<span class="stringliteral">&quot;\&quot;)&quot;</span>);</div>
+<div class="line"><a name="l01265"></a><span class="lineno"> 1265</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l01266"></a><span class="lineno"> 1266</span>&#160;        this-&gt;customIP = customIP;</div>
+<div class="line"><a name="l01267"></a><span class="lineno"> 1267</span>&#160;        this-&gt;customHostName = NULL;</div>
+<div class="line"><a name="l01268"></a><span class="lineno"> 1268</span>&#160;        this-&gt;port = port;</div>
+<div class="line"><a name="l01269"></a><span class="lineno"> 1269</span>&#160;    };</div>
+<div class="line"><a name="l01270"></a><span class="lineno"> 1270</span>&#160;</div>
+<div class="line"><a name="l01271"></a><span class="lineno"> 1271</span>&#160;    <span class="keywordtype">void</span> setServer()</div>
+<div class="line"><a name="l01272"></a><span class="lineno"> 1272</span>&#160;    {</div>
+<div class="line"><a name="l01273"></a><span class="lineno"> 1273</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l01274"></a><span class="lineno"> 1274</span>&#160;            Serial.print(<span class="stringliteral">&quot;ts::setServer  (default)&quot;</span>);</div>
+<div class="line"><a name="l01275"></a><span class="lineno"> 1275</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l01276"></a><span class="lineno"> 1276</span>&#160;        this-&gt;customIP = INADDR_NONE;</div>
+<div class="line"><a name="l01277"></a><span class="lineno"> 1277</span>&#160;        this-&gt;customHostName = NULL;</div>
+<div class="line"><a name="l01278"></a><span class="lineno"> 1278</span>&#160;        this-&gt;port = THINGSPEAK_PORT_NUMBER;</div>
+<div class="line"><a name="l01279"></a><span class="lineno"> 1279</span>&#160;    };</div>
+<div class="line"><a name="l01280"></a><span class="lineno"> 1280</span>&#160;</div>
+<div class="line"><a name="l01281"></a><span class="lineno"> 1281</span>&#160;    <span class="keywordtype">void</span> setClient(Client * client) {this-&gt;client = client;};</div>
+<div class="line"><a name="l01282"></a><span class="lineno"> 1282</span>&#160;</div>
+<div class="line"><a name="l01283"></a><span class="lineno"> 1283</span>&#160;    Client * client = NULL;</div>
+<div class="line"><a name="l01284"></a><span class="lineno"> 1284</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span> * customHostName = NULL;</div>
+<div class="line"><a name="l01285"></a><span class="lineno"> 1285</span>&#160;    IPAddress customIP = INADDR_NONE;</div>
+<div class="line"><a name="l01286"></a><span class="lineno"> 1286</span>&#160;    <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> port = THINGSPEAK_PORT_NUMBER;</div>
+<div class="line"><a name="l01287"></a><span class="lineno"> 1287</span>&#160;    String nextWriteField[8];</div>
+<div class="line"><a name="l01288"></a><span class="lineno"> 1288</span>&#160;    <span class="keywordtype">float</span> nextWriteLatitude;</div>
+<div class="line"><a name="l01289"></a><span class="lineno"> 1289</span>&#160;    <span class="keywordtype">float</span> nextWriteLongitude;</div>
+<div class="line"><a name="l01290"></a><span class="lineno"> 1290</span>&#160;    <span class="keywordtype">float</span> nextWriteElevation;</div>
+<div class="line"><a name="l01291"></a><span class="lineno"> 1291</span>&#160;    <span class="keywordtype">int</span> lastReadStatus;</div>
+<div class="line"><a name="l01292"></a><span class="lineno"> 1292</span>&#160;</div>
+<div class="line"><a name="l01293"></a><span class="lineno"> 1293</span>&#160;    <span class="keywordtype">bool</span> connectThingSpeak()</div>
+<div class="line"><a name="l01294"></a><span class="lineno"> 1294</span>&#160;    {</div>
+<div class="line"><a name="l01295"></a><span class="lineno"> 1295</span>&#160;        <span class="keywordtype">bool</span> connectSuccess = <span class="keyword">false</span>;</div>
+<div class="line"><a name="l01296"></a><span class="lineno"> 1296</span>&#160;        <span class="keywordflow">if</span>(this-&gt;customIP == INADDR_NONE &amp;&amp; NULL == this-&gt;customHostName)</div>
+<div class="line"><a name="l01297"></a><span class="lineno"> 1297</span>&#160;        {</div>
+<div class="line"><a name="l01298"></a><span class="lineno"> 1298</span>&#160;<span class="preprocessor">            #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l01299"></a><span class="lineno"> 1299</span>&#160;                Serial.print(<span class="stringliteral">&quot;               Connect to default ThingSpeak URL...&quot;</span>);</div>
+<div class="line"><a name="l01300"></a><span class="lineno"> 1300</span>&#160;<span class="preprocessor">            #endif</span></div>
+<div class="line"><a name="l01301"></a><span class="lineno"> 1301</span>&#160;            connectSuccess = client-&gt;connect(THINGSPEAK_URL,THINGSPEAK_PORT_NUMBER);</div>
+<div class="line"><a name="l01302"></a><span class="lineno"> 1302</span>&#160;            <span class="keywordflow">if</span>(!connectSuccess)</div>
+<div class="line"><a name="l01303"></a><span class="lineno"> 1303</span>&#160;            {</div>
+<div class="line"><a name="l01304"></a><span class="lineno"> 1304</span>&#160;<span class="preprocessor">                #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l01305"></a><span class="lineno"> 1305</span>&#160;                    Serial.print(<span class="stringliteral">&quot;Failed. Try default IP...&quot;</span>);</div>
+<div class="line"><a name="l01306"></a><span class="lineno"> 1306</span>&#160;<span class="preprocessor">                #endif</span></div>
+<div class="line"><a name="l01307"></a><span class="lineno"> 1307</span>&#160;                connectSuccess = client-&gt;connect(THINGSPEAK_IPADDRESS,THINGSPEAK_PORT_NUMBER);</div>
+<div class="line"><a name="l01308"></a><span class="lineno"> 1308</span>&#160;            }</div>
+<div class="line"><a name="l01309"></a><span class="lineno"> 1309</span>&#160;       }</div>
+<div class="line"><a name="l01310"></a><span class="lineno"> 1310</span>&#160;       <span class="keywordflow">else</span></div>
+<div class="line"><a name="l01311"></a><span class="lineno"> 1311</span>&#160;       {</div>
+<div class="line"><a name="l01312"></a><span class="lineno"> 1312</span>&#160;            <span class="keywordflow">if</span>(!(this-&gt;customIP == INADDR_NONE))</div>
+<div class="line"><a name="l01313"></a><span class="lineno"> 1313</span>&#160;            {</div>
+<div class="line"><a name="l01314"></a><span class="lineno"> 1314</span>&#160;                <span class="comment">// Connect to the server on port 80 (HTTP) at the customIP address</span></div>
+<div class="line"><a name="l01315"></a><span class="lineno"> 1315</span>&#160;<span class="preprocessor">                #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l01316"></a><span class="lineno"> 1316</span>&#160;                  Serial.print(<span class="stringliteral">&quot;               Connect to &quot;</span>);Serial.print(this-&gt;customIP);Serial.print(<span class="stringliteral">&quot;...&quot;</span>);</div>
+<div class="line"><a name="l01317"></a><span class="lineno"> 1317</span>&#160;<span class="preprocessor">                #endif</span></div>
+<div class="line"><a name="l01318"></a><span class="lineno"> 1318</span>&#160;                connectSuccess = client-&gt;connect(this-&gt;customIP,this-&gt;port);</div>
+<div class="line"><a name="l01319"></a><span class="lineno"> 1319</span>&#160;            }</div>
+<div class="line"><a name="l01320"></a><span class="lineno"> 1320</span>&#160;            <span class="keywordflow">if</span>(NULL != this-&gt;customHostName)</div>
+<div class="line"><a name="l01321"></a><span class="lineno"> 1321</span>&#160;            {</div>
+<div class="line"><a name="l01322"></a><span class="lineno"> 1322</span>&#160;                <span class="comment">// Connect to the server on port 80 (HTTP) at the URL address</span></div>
+<div class="line"><a name="l01323"></a><span class="lineno"> 1323</span>&#160;<span class="preprocessor">                #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l01324"></a><span class="lineno"> 1324</span>&#160;<span class="preprocessor">                  #ifdef SPARK</span></div>
+<div class="line"><a name="l01325"></a><span class="lineno"> 1325</span>&#160;                    Particle.publish(SPARK_PUBLISH_TOPIC, <span class="stringliteral">&quot;Attempt Connect to URL &quot;</span> + String(this-&gt;customHostName), SPARK_PUBLISH_TTL, PRIVATE);</div>
+<div class="line"><a name="l01326"></a><span class="lineno"> 1326</span>&#160;<span class="preprocessor">                  #else</span></div>
+<div class="line"><a name="l01327"></a><span class="lineno"> 1327</span>&#160;                    Serial.print(<span class="stringliteral">&quot;               Connect to &quot;</span>);Serial.print(this-&gt;customHostName);Serial.print(<span class="stringliteral">&quot; ...&quot;</span>);</div>
+<div class="line"><a name="l01328"></a><span class="lineno"> 1328</span>&#160;<span class="preprocessor">                  #endif</span></div>
+<div class="line"><a name="l01329"></a><span class="lineno"> 1329</span>&#160;<span class="preprocessor">                #endif</span></div>
+<div class="line"><a name="l01330"></a><span class="lineno"> 1330</span>&#160;                connectSuccess = client-&gt;connect(customHostName,this-&gt;port);</div>
+<div class="line"><a name="l01331"></a><span class="lineno"> 1331</span>&#160;            }</div>
+<div class="line"><a name="l01332"></a><span class="lineno"> 1332</span>&#160;        }</div>
+<div class="line"><a name="l01333"></a><span class="lineno"> 1333</span>&#160;</div>
+<div class="line"><a name="l01334"></a><span class="lineno"> 1334</span>&#160;<span class="preprocessor">        #ifdef PRINT_DEBUG_MESSAGES</span></div>
+<div class="line"><a name="l01335"></a><span class="lineno"> 1335</span>&#160;        <span class="keywordflow">if</span> (connectSuccess)</div>
+<div class="line"><a name="l01336"></a><span class="lineno"> 1336</span>&#160;        {</div>
+<div class="line"><a name="l01337"></a><span class="lineno"> 1337</span>&#160;<span class="preprocessor">            #ifdef SPARK</span></div>
+<div class="line"><a name="l01338"></a><span class="lineno"> 1338</span>&#160;              Particle.publish(SPARK_PUBLISH_TOPIC, <span class="stringliteral">&quot;Connection Success&quot;</span>, SPARK_PUBLISH_TTL, PRIVATE);</div>
+<div class="line"><a name="l01339"></a><span class="lineno"> 1339</span>&#160;<span class="preprocessor">            #else</span></div>
+<div class="line"><a name="l01340"></a><span class="lineno"> 1340</span>&#160;              Serial.println(<span class="stringliteral">&quot;Success.&quot;</span>);</div>
+<div class="line"><a name="l01341"></a><span class="lineno"> 1341</span>&#160;<span class="preprocessor">            #endif</span></div>
+<div class="line"><a name="l01342"></a><span class="lineno"> 1342</span>&#160;        }</div>
+<div class="line"><a name="l01343"></a><span class="lineno"> 1343</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l01344"></a><span class="lineno"> 1344</span>&#160;        {</div>
+<div class="line"><a name="l01345"></a><span class="lineno"> 1345</span>&#160;<span class="preprocessor">            #ifdef SPARK</span></div>
+<div class="line"><a name="l01346"></a><span class="lineno"> 1346</span>&#160;              Particle.publish(SPARK_PUBLISH_TOPIC, <span class="stringliteral">&quot;Connection Failure&quot;</span>, SPARK_PUBLISH_TTL, PRIVATE);</div>
+<div class="line"><a name="l01347"></a><span class="lineno"> 1347</span>&#160;<span class="preprocessor">            #else</span></div>
+<div class="line"><a name="l01348"></a><span class="lineno"> 1348</span>&#160;              Serial.println(<span class="stringliteral">&quot;Failed.&quot;</span>);</div>
+<div class="line"><a name="l01349"></a><span class="lineno"> 1349</span>&#160;<span class="preprocessor">            #endif</span></div>
+<div class="line"><a name="l01350"></a><span class="lineno"> 1350</span>&#160;        }</div>
+<div class="line"><a name="l01351"></a><span class="lineno"> 1351</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l01352"></a><span class="lineno"> 1352</span>&#160;        <span class="keywordflow">return</span> connectSuccess;</div>
+<div class="line"><a name="l01353"></a><span class="lineno"> 1353</span>&#160;    };</div>
+<div class="line"><a name="l01354"></a><span class="lineno"> 1354</span>&#160;</div>
+<div class="line"><a name="l01355"></a><span class="lineno"> 1355</span>&#160;    <span class="keywordtype">bool</span> writeHTTPHeader(<span class="keyword">const</span> <span class="keywordtype">char</span> * APIKey)</div>
+<div class="line"><a name="l01356"></a><span class="lineno"> 1356</span>&#160;    {</div>
+<div class="line"><a name="l01357"></a><span class="lineno"> 1357</span>&#160;        <span class="keywordflow">if</span>(NULL != this-&gt;customHostName)</div>
+<div class="line"><a name="l01358"></a><span class="lineno"> 1358</span>&#160;        {</div>
+<div class="line"><a name="l01359"></a><span class="lineno"> 1359</span>&#160;            <span class="keywordflow">if</span> (!this-&gt;client-&gt;print(<span class="stringliteral">&quot;Host: &quot;</span>)) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l01360"></a><span class="lineno"> 1360</span>&#160;            <span class="keywordflow">if</span> (!this-&gt;client-&gt;print(this-&gt;customHostName)) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l01361"></a><span class="lineno"> 1361</span>&#160;            <span class="keywordflow">if</span> (!this-&gt;client-&gt;print(<span class="stringliteral">&quot;\n&quot;</span>)) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l01362"></a><span class="lineno"> 1362</span>&#160;        }</div>
+<div class="line"><a name="l01363"></a><span class="lineno"> 1363</span>&#160;        <span class="keywordflow">else</span></div>
+<div class="line"><a name="l01364"></a><span class="lineno"> 1364</span>&#160;        {</div>
+<div class="line"><a name="l01365"></a><span class="lineno"> 1365</span>&#160;            <span class="keywordflow">if</span> (!this-&gt;client-&gt;print(<span class="stringliteral">&quot;Host: api.thingspeak.com\n&quot;</span>)) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l01366"></a><span class="lineno"> 1366</span>&#160;        }</div>
+<div class="line"><a name="l01367"></a><span class="lineno"> 1367</span>&#160;        <span class="keywordflow">if</span> (!this-&gt;client-&gt;print(<span class="stringliteral">&quot;Connection: close\n&quot;</span>)) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l01368"></a><span class="lineno"> 1368</span>&#160;        <span class="keywordflow">if</span> (!this-&gt;client-&gt;print(<span class="stringliteral">&quot;User-Agent: &quot;</span>)) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l01369"></a><span class="lineno"> 1369</span>&#160;        <span class="keywordflow">if</span> (!this-&gt;client-&gt;print(TS_USER_AGENT)) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l01370"></a><span class="lineno"> 1370</span>&#160;        <span class="keywordflow">if</span> (!this-&gt;client-&gt;print(<span class="stringliteral">&quot;\n&quot;</span>)) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l01371"></a><span class="lineno"> 1371</span>&#160;        <span class="keywordflow">if</span>(NULL != APIKey)</div>
+<div class="line"><a name="l01372"></a><span class="lineno"> 1372</span>&#160;        {</div>
+<div class="line"><a name="l01373"></a><span class="lineno"> 1373</span>&#160;            <span class="keywordflow">if</span> (!this-&gt;client-&gt;print(<span class="stringliteral">&quot;X-THINGSPEAKAPIKEY: &quot;</span>)) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l01374"></a><span class="lineno"> 1374</span>&#160;            <span class="keywordflow">if</span> (!this-&gt;client-&gt;print(APIKey)) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l01375"></a><span class="lineno"> 1375</span>&#160;            <span class="keywordflow">if</span> (!this-&gt;client-&gt;print(<span class="stringliteral">&quot;\n&quot;</span>)) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
+<div class="line"><a name="l01376"></a><span class="lineno"> 1376</span>&#160;        }</div>
+<div class="line"><a name="l01377"></a><span class="lineno"> 1377</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
+<div class="line"><a name="l01378"></a><span class="lineno"> 1378</span>&#160;    };</div>
+<div class="line"><a name="l01379"></a><span class="lineno"> 1379</span>&#160;</div>
+<div class="line"><a name="l01380"></a><span class="lineno"> 1380</span>&#160;    <span class="keywordtype">int</span> getHTTPResponse(String &amp; response)</div>
+<div class="line"><a name="l01381"></a><span class="lineno"> 1381</span>&#160;    {</div>
+<div class="line"><a name="l01382"></a><span class="lineno"> 1382</span>&#160;        <span class="keywordtype">long</span> startWaitForResponseAt = millis();</div>
+<div class="line"><a name="l01383"></a><span class="lineno"> 1383</span>&#160;        <span class="keywordflow">while</span>(client-&gt;available() == 0 &amp;&amp; millis() - startWaitForResponseAt &lt; TIMEOUT_MS_SERVERRESPONSE)</div>
+<div class="line"><a name="l01384"></a><span class="lineno"> 1384</span>&#160;        {</div>
+<div class="line"><a name="l01385"></a><span class="lineno"> 1385</span>&#160;            delay(100);</div>
+<div class="line"><a name="l01386"></a><span class="lineno"> 1386</span>&#160;        }</div>
+<div class="line"><a name="l01387"></a><span class="lineno"> 1387</span>&#160;        <span class="keywordflow">if</span>(client-&gt;available() == 0)</div>
+<div class="line"><a name="l01388"></a><span class="lineno"> 1388</span>&#160;        {</div>
+<div class="line"><a name="l01389"></a><span class="lineno"> 1389</span>&#160;            <span class="keywordflow">return</span> ERR_TIMEOUT; <span class="comment">// Didn&#39;t get server response in time</span></div>
+<div class="line"><a name="l01390"></a><span class="lineno"> 1390</span>&#160;        }</div>
+<div class="line"><a name="l01391"></a><span class="lineno"> 1391</span>&#160;</div>
+<div class="line"><a name="l01392"></a><span class="lineno"> 1392</span>&#160;        <span class="keywordflow">if</span>(!client-&gt;find(const_cast&lt;char *&gt;(<span class="stringliteral">&quot;HTTP/1.1&quot;</span>)))</div>
+<div class="line"><a name="l01393"></a><span class="lineno"> 1393</span>&#160;        {</div>
+<div class="line"><a name="l01394"></a><span class="lineno"> 1394</span>&#160;<span class="preprocessor">            #ifdef PRINT_HTTP</span></div>
+<div class="line"><a name="l01395"></a><span class="lineno"> 1395</span>&#160;<span class="preprocessor">                #ifdef SPARK</span></div>
+<div class="line"><a name="l01396"></a><span class="lineno"> 1396</span>&#160;                    Particle.publish(SPARK_PUBLISH_TOPIC, <span class="stringliteral">&quot;ERROR: Didn&#39;t find HTTP/1.1&quot;</span>, SPARK_PUBLISH_TTL, PRIVATE);</div>
+<div class="line"><a name="l01397"></a><span class="lineno"> 1397</span>&#160;<span class="preprocessor">                #else</span></div>
+<div class="line"><a name="l01398"></a><span class="lineno"> 1398</span>&#160;                    Serial.println(<span class="stringliteral">&quot;ERROR: Didn&#39;t find HTTP/1.1&quot;</span>);</div>
+<div class="line"><a name="l01399"></a><span class="lineno"> 1399</span>&#160;<span class="preprocessor">                #endif</span></div>
+<div class="line"><a name="l01400"></a><span class="lineno"> 1400</span>&#160;<span class="preprocessor">            #endif</span></div>
+<div class="line"><a name="l01401"></a><span class="lineno"> 1401</span>&#160;            <span class="keywordflow">return</span> ERR_BAD_RESPONSE; <span class="comment">// Couldn&#39;t parse response (didn&#39;t find HTTP/1.1)</span></div>
+<div class="line"><a name="l01402"></a><span class="lineno"> 1402</span>&#160;        }</div>
+<div class="line"><a name="l01403"></a><span class="lineno"> 1403</span>&#160;        <span class="keywordtype">int</span> status = client-&gt;parseInt();</div>
+<div class="line"><a name="l01404"></a><span class="lineno"> 1404</span>&#160;<span class="preprocessor">        #ifdef PRINT_HTTP</span></div>
+<div class="line"><a name="l01405"></a><span class="lineno"> 1405</span>&#160;<span class="preprocessor">            #ifdef SPARK</span></div>
+<div class="line"><a name="l01406"></a><span class="lineno"> 1406</span>&#160;                Particle.publish(SPARK_PUBLISH_TOPIC, <span class="stringliteral">&quot;Got Status of &quot;</span> + String(status), SPARK_PUBLISH_TTL, PRIVATE);</div>
+<div class="line"><a name="l01407"></a><span class="lineno"> 1407</span>&#160;<span class="preprocessor">            #else</span></div>
+<div class="line"><a name="l01408"></a><span class="lineno"> 1408</span>&#160;                Serial.print(<span class="stringliteral">&quot;Got Status of &quot;</span>);Serial.println(status);</div>
+<div class="line"><a name="l01409"></a><span class="lineno"> 1409</span>&#160;<span class="preprocessor">            #endif</span></div>
+<div class="line"><a name="l01410"></a><span class="lineno"> 1410</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l01411"></a><span class="lineno"> 1411</span>&#160;        <span class="keywordflow">if</span>(status != OK_SUCCESS)</div>
+<div class="line"><a name="l01412"></a><span class="lineno"> 1412</span>&#160;        {</div>
+<div class="line"><a name="l01413"></a><span class="lineno"> 1413</span>&#160;            <span class="keywordflow">return</span> status;</div>
+<div class="line"><a name="l01414"></a><span class="lineno"> 1414</span>&#160;        }</div>
+<div class="line"><a name="l01415"></a><span class="lineno"> 1415</span>&#160;</div>
+<div class="line"><a name="l01416"></a><span class="lineno"> 1416</span>&#160;        <span class="keywordflow">if</span>(!client-&gt;find(const_cast&lt;char *&gt;(<span class="stringliteral">&quot;\r\n&quot;</span>)))</div>
+<div class="line"><a name="l01417"></a><span class="lineno"> 1417</span>&#160;        {</div>
+<div class="line"><a name="l01418"></a><span class="lineno"> 1418</span>&#160;<span class="preprocessor">            #ifdef PRINT_HTTP</span></div>
+<div class="line"><a name="l01419"></a><span class="lineno"> 1419</span>&#160;<span class="preprocessor">                #ifdef SPARK</span></div>
+<div class="line"><a name="l01420"></a><span class="lineno"> 1420</span>&#160;                    Particle.publish(SPARK_PUBLISH_TOPIC, <span class="stringliteral">&quot;ERROR: Didn&#39;t find end of status line&quot;</span>, SPARK_PUBLISH_TTL, PRIVATE);</div>
+<div class="line"><a name="l01421"></a><span class="lineno"> 1421</span>&#160;<span class="preprocessor">                #else</span></div>
+<div class="line"><a name="l01422"></a><span class="lineno"> 1422</span>&#160;                    Serial.println(<span class="stringliteral">&quot;ERROR: Didn&#39;t find end of status line&quot;</span>);</div>
+<div class="line"><a name="l01423"></a><span class="lineno"> 1423</span>&#160;<span class="preprocessor">                #endif</span></div>
+<div class="line"><a name="l01424"></a><span class="lineno"> 1424</span>&#160;<span class="preprocessor">            #endif</span></div>
+<div class="line"><a name="l01425"></a><span class="lineno"> 1425</span>&#160;            <span class="keywordflow">return</span> ERR_BAD_RESPONSE;</div>
+<div class="line"><a name="l01426"></a><span class="lineno"> 1426</span>&#160;        }</div>
+<div class="line"><a name="l01427"></a><span class="lineno"> 1427</span>&#160;<span class="preprocessor">        #ifdef PRINT_HTTP</span></div>
+<div class="line"><a name="l01428"></a><span class="lineno"> 1428</span>&#160;<span class="preprocessor">            #ifdef SPARK</span></div>
+<div class="line"><a name="l01429"></a><span class="lineno"> 1429</span>&#160;                Particle.publish(SPARK_PUBLISH_TOPIC, <span class="stringliteral">&quot;Found end of status line&quot;</span>, SPARK_PUBLISH_TTL, PRIVATE);</div>
+<div class="line"><a name="l01430"></a><span class="lineno"> 1430</span>&#160;<span class="preprocessor">            #else</span></div>
+<div class="line"><a name="l01431"></a><span class="lineno"> 1431</span>&#160;                Serial.println(<span class="stringliteral">&quot;Found end of status line&quot;</span>);</div>
+<div class="line"><a name="l01432"></a><span class="lineno"> 1432</span>&#160;<span class="preprocessor">            #endif</span></div>
+<div class="line"><a name="l01433"></a><span class="lineno"> 1433</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l01434"></a><span class="lineno"> 1434</span>&#160;</div>
+<div class="line"><a name="l01435"></a><span class="lineno"> 1435</span>&#160;        <span class="keywordflow">if</span>(!client-&gt;find(const_cast&lt;char *&gt;(<span class="stringliteral">&quot;\n\r\n&quot;</span>)))</div>
+<div class="line"><a name="l01436"></a><span class="lineno"> 1436</span>&#160;        {</div>
+<div class="line"><a name="l01437"></a><span class="lineno"> 1437</span>&#160;<span class="preprocessor">            #ifdef PRINT_HTTP</span></div>
+<div class="line"><a name="l01438"></a><span class="lineno"> 1438</span>&#160;<span class="preprocessor">                #ifdef SPARK</span></div>
+<div class="line"><a name="l01439"></a><span class="lineno"> 1439</span>&#160;                    Particle.publish(SPARK_PUBLISH_TOPIC, <span class="stringliteral">&quot;ERROR: Didn&#39;t find end of header&quot;</span>, SPARK_PUBLISH_TTL, PRIVATE);</div>
+<div class="line"><a name="l01440"></a><span class="lineno"> 1440</span>&#160;<span class="preprocessor">                #else</span></div>
+<div class="line"><a name="l01441"></a><span class="lineno"> 1441</span>&#160;                    Serial.println(<span class="stringliteral">&quot;ERROR: Didn&#39;t find end of header&quot;</span>);</div>
+<div class="line"><a name="l01442"></a><span class="lineno"> 1442</span>&#160;<span class="preprocessor">                #endif</span></div>
+<div class="line"><a name="l01443"></a><span class="lineno"> 1443</span>&#160;<span class="preprocessor">            #endif</span></div>
+<div class="line"><a name="l01444"></a><span class="lineno"> 1444</span>&#160;            <span class="keywordflow">return</span> ERR_BAD_RESPONSE;</div>
+<div class="line"><a name="l01445"></a><span class="lineno"> 1445</span>&#160;        }</div>
+<div class="line"><a name="l01446"></a><span class="lineno"> 1446</span>&#160;<span class="preprocessor">        #ifdef PRINT_HTTP</span></div>
+<div class="line"><a name="l01447"></a><span class="lineno"> 1447</span>&#160;<span class="preprocessor">            #ifdef SPARK</span></div>
+<div class="line"><a name="l01448"></a><span class="lineno"> 1448</span>&#160;                Particle.publish(SPARK_PUBLISH_TOPIC, <span class="stringliteral">&quot;Found end of header&quot;</span>, SPARK_PUBLISH_TTL, PRIVATE);</div>
+<div class="line"><a name="l01449"></a><span class="lineno"> 1449</span>&#160;<span class="preprocessor">            #else</span></div>
+<div class="line"><a name="l01450"></a><span class="lineno"> 1450</span>&#160;                Serial.println(<span class="stringliteral">&quot;Found end of header&quot;</span>);</div>
+<div class="line"><a name="l01451"></a><span class="lineno"> 1451</span>&#160;<span class="preprocessor">            #endif</span></div>
+<div class="line"><a name="l01452"></a><span class="lineno"> 1452</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l01453"></a><span class="lineno"> 1453</span>&#160;        <span class="comment">// This is a workaround to a bug in the Spark implementation of String</span></div>
+<div class="line"><a name="l01454"></a><span class="lineno"> 1454</span>&#160;        String tempString = client-&gt;readStringUntil(<span class="charliteral">&#39;\r&#39;</span>);</div>
+<div class="line"><a name="l01455"></a><span class="lineno"> 1455</span>&#160;        response = tempString;</div>
+<div class="line"><a name="l01456"></a><span class="lineno"> 1456</span>&#160;<span class="preprocessor">        #ifdef PRINT_HTTP</span></div>
+<div class="line"><a name="l01457"></a><span class="lineno"> 1457</span>&#160;<span class="preprocessor">            #ifdef SPARK</span></div>
+<div class="line"><a name="l01458"></a><span class="lineno"> 1458</span>&#160;                Particle.publish(SPARK_PUBLISH_TOPIC, <span class="stringliteral">&quot;Response: \&quot;&quot;</span> + tempString + <span class="stringliteral">&quot;\&quot;&quot;</span>, SPARK_PUBLISH_TTL, PRIVATE);</div>
+<div class="line"><a name="l01459"></a><span class="lineno"> 1459</span>&#160;<span class="preprocessor">            #else</span></div>
+<div class="line"><a name="l01460"></a><span class="lineno"> 1460</span>&#160;                Serial.print(<span class="stringliteral">&quot;Response: \&quot;&quot;</span>);Serial.print(response);Serial.println(<span class="stringliteral">&quot;\&quot;&quot;</span>);</div>
+<div class="line"><a name="l01461"></a><span class="lineno"> 1461</span>&#160;<span class="preprocessor">            #endif</span></div>
+<div class="line"><a name="l01462"></a><span class="lineno"> 1462</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l01463"></a><span class="lineno"> 1463</span>&#160;        <span class="keywordflow">return</span> status;</div>
+<div class="line"><a name="l01464"></a><span class="lineno"> 1464</span>&#160;    };</div>
+<div class="line"><a name="l01465"></a><span class="lineno"> 1465</span>&#160;</div>
+<div class="line"><a name="l01466"></a><span class="lineno"> 1466</span>&#160;    <span class="keywordtype">int</span> convertFloatToChar(<span class="keywordtype">float</span> value, <span class="keywordtype">char</span> *valueString)</div>
+<div class="line"><a name="l01467"></a><span class="lineno"> 1467</span>&#160;    {</div>
+<div class="line"><a name="l01468"></a><span class="lineno"> 1468</span>&#160;        <span class="comment">// Supported range is -999999000000 to 999999000000</span></div>
+<div class="line"><a name="l01469"></a><span class="lineno"> 1469</span>&#160;        <span class="keywordflow">if</span>(0 == isinf(value) &amp;&amp; (value &gt; 999999000000 || value &lt; -999999000000))</div>
+<div class="line"><a name="l01470"></a><span class="lineno"> 1470</span>&#160;        {</div>
+<div class="line"><a name="l01471"></a><span class="lineno"> 1471</span>&#160;            <span class="comment">// Out of range</span></div>
+<div class="line"><a name="l01472"></a><span class="lineno"> 1472</span>&#160;            <span class="keywordflow">return</span> ERR_OUT_OF_RANGE;</div>
+<div class="line"><a name="l01473"></a><span class="lineno"> 1473</span>&#160;        }</div>
+<div class="line"><a name="l01474"></a><span class="lineno"> 1474</span>&#160;        <span class="comment">// Given that the resolution of Spark is 1 / 2^12, or ~0.00024 volts, assume that 5 places right of decimal should be sufficient for most applications</span></div>
+<div class="line"><a name="l01475"></a><span class="lineno"> 1475</span>&#160;<span class="preprocessor">        #ifdef PARTICLE_PHOTONELECTRON</span></div>
+<div class="line"><a name="l01476"></a><span class="lineno"> 1476</span>&#160;          <span class="comment">//Photon doesn&#39;t have a dtostrf, but does have dtoa</span></div>
+<div class="line"><a name="l01477"></a><span class="lineno"> 1477</span>&#160;          dtoa((<span class="keywordtype">double</span>)value,5, valueString);</div>
+<div class="line"><a name="l01478"></a><span class="lineno"> 1478</span>&#160;<span class="preprocessor">        #else</span></div>
+<div class="line"><a name="l01479"></a><span class="lineno"> 1479</span>&#160;          dtostrf(value,1,5, valueString);</div>
+<div class="line"><a name="l01480"></a><span class="lineno"> 1480</span>&#160;<span class="preprocessor">        #endif</span></div>
+<div class="line"><a name="l01481"></a><span class="lineno"> 1481</span>&#160;        <span class="keywordflow">return</span> OK_SUCCESS;</div>
+<div class="line"><a name="l01482"></a><span class="lineno"> 1482</span>&#160;    };</div>
+<div class="line"><a name="l01483"></a><span class="lineno"> 1483</span>&#160;</div>
+<div class="line"><a name="l01484"></a><span class="lineno"> 1484</span>&#160;    <span class="keywordtype">float</span> convertStringToFloat(String value)</div>
+<div class="line"><a name="l01485"></a><span class="lineno"> 1485</span>&#160;    {</div>
+<div class="line"><a name="l01486"></a><span class="lineno"> 1486</span>&#160;        <span class="comment">// There&#39;s a bug in the AVR function strtod that it doesn&#39;t decode -INF correctly (it maps it to INF)</span></div>
+<div class="line"><a name="l01487"></a><span class="lineno"> 1487</span>&#160;        <span class="keywordtype">float</span> result = value.toFloat();</div>
+<div class="line"><a name="l01488"></a><span class="lineno"> 1488</span>&#160;        <span class="keywordflow">if</span>(1 == isinf(result) &amp;&amp; *value.c_str() == <span class="charliteral">&#39;-&#39;</span>)</div>
+<div class="line"><a name="l01489"></a><span class="lineno"> 1489</span>&#160;        {</div>
+<div class="line"><a name="l01490"></a><span class="lineno"> 1490</span>&#160;            result = (float)-INFINITY;</div>
+<div class="line"><a name="l01491"></a><span class="lineno"> 1491</span>&#160;        }</div>
+<div class="line"><a name="l01492"></a><span class="lineno"> 1492</span>&#160;        <span class="keywordflow">return</span> result;</div>
+<div class="line"><a name="l01493"></a><span class="lineno"> 1493</span>&#160;    };</div>
+<div class="line"><a name="l01494"></a><span class="lineno"> 1494</span>&#160;</div>
+<div class="line"><a name="l01495"></a><span class="lineno"> 1495</span>&#160;    <span class="keywordtype">void</span> resetWriteFields()</div>
+<div class="line"><a name="l01496"></a><span class="lineno"> 1496</span>&#160;    {</div>
+<div class="line"><a name="l01497"></a><span class="lineno"> 1497</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> iField = 0; iField &lt; 8; iField++)</div>
+<div class="line"><a name="l01498"></a><span class="lineno"> 1498</span>&#160;        {</div>
+<div class="line"><a name="l01499"></a><span class="lineno"> 1499</span>&#160;            this-&gt;nextWriteField[iField] = <span class="stringliteral">&quot;&quot;</span>;</div>
+<div class="line"><a name="l01500"></a><span class="lineno"> 1500</span>&#160;        }</div>
+<div class="line"><a name="l01501"></a><span class="lineno"> 1501</span>&#160;        this-&gt;nextWriteLatitude = NAN;</div>
+<div class="line"><a name="l01502"></a><span class="lineno"> 1502</span>&#160;        this-&gt;nextWriteLongitude = NAN;</div>
+<div class="line"><a name="l01503"></a><span class="lineno"> 1503</span>&#160;        this-&gt;nextWriteElevation = NAN;</div>
+<div class="line"><a name="l01504"></a><span class="lineno"> 1504</span>&#160;    };</div>
+<div class="line"><a name="l01505"></a><span class="lineno"> 1505</span>&#160;};</div>
+<div class="line"><a name="l01506"></a><span class="lineno"> 1506</span>&#160;</div>
+<div class="line"><a name="l01507"></a><span class="lineno"> 1507</span>&#160;<span class="keyword">extern</span> <a class="code" href="class_thing_speak_class.html">ThingSpeakClass</a> ThingSpeak;</div>
+<div class="line"><a name="l01508"></a><span class="lineno"> 1508</span>&#160;</div>
+<div class="line"><a name="l01509"></a><span class="lineno"> 1509</span>&#160;<span class="preprocessor">#endif //ThingSpeak_h</span></div>
+<div class="ttc" id="class_thing_speak_class_html_a2a5333f683802cb455a3713d604abb84"><div class="ttname"><a href="class_thing_speak_class.html#a2a5333f683802cb455a3713d604abb84">ThingSpeakClass::writeRaw</a></div><div class="ttdeci">int writeRaw(unsigned long channelNumber, const char *postMessage, const char *writeAPIKey)</div><div class="ttdoc">Write a raw POST to a ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:842</div></div>
+<div class="ttc" id="class_thing_speak_class_html_aa1534ea566b7f9fc951a41f8cf41f53b"><div class="ttname"><a href="class_thing_speak_class.html#aa1534ea566b7f9fc951a41f8cf41f53b">ThingSpeakClass::readStringField</a></div><div class="ttdeci">String readStringField(unsigned long channelNumber, unsigned int field, const char *readAPIKey)</div><div class="ttdoc">Read the latest string from a private ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:937</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a7ed5914c2f5c7d84672cdaae3547da96"><div class="ttname"><a href="class_thing_speak_class.html#a7ed5914c2f5c7d84672cdaae3547da96">ThingSpeakClass::readStringField</a></div><div class="ttdeci">String readStringField(unsigned long channelNumber, unsigned int field)</div><div class="ttdoc">Read the latest string from a public ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:970</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a8dba6e69d9cc12e5c5efe5043df02d81"><div class="ttname"><a href="class_thing_speak_class.html#a8dba6e69d9cc12e5c5efe5043df02d81">ThingSpeakClass::setField</a></div><div class="ttdeci">int setField(unsigned int field, long value)</div><div class="ttdoc">Set the value of a single field that will be part of a multi-field update. To write multiple fields a...</div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:465</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a7c3415bd86e0fa2c335d3b245912fb55"><div class="ttname"><a href="class_thing_speak_class.html#a7c3415bd86e0fa2c335d3b245912fb55">ThingSpeakClass::writeRaw</a></div><div class="ttdeci">int writeRaw(unsigned long channelNumber, String postMessage, const char *writeAPIKey)</div><div class="ttdoc">Write a raw POST to a ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:863</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a8bedb31c0f619bed57944aca13b423d7"><div class="ttname"><a href="class_thing_speak_class.html#a8bedb31c0f619bed57944aca13b423d7">ThingSpeakClass::begin</a></div><div class="ttdeci">bool begin(Client &amp;client, IPAddress customIP, unsigned int port)</div><div class="ttdoc">Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak...</div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:198</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a986d1958d5aa6705a53a31f3975f8cae"><div class="ttname"><a href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">ThingSpeakClass::writeFields</a></div><div class="ttdeci">int writeFields(unsigned long channelNumber, const char *writeAPIKey)</div><div class="ttdoc">Write a multi-field update. Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields() </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:760</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a72eea45043ab45051c02593983d29546"><div class="ttname"><a href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">ThingSpeakClass::setField</a></div><div class="ttdeci">int setField(unsigned int field, int value)</div><div class="ttdoc">Set the value of a single field that will be part of a multi-field update. To write multiple fields a...</div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:421</div></div>
+<div class="ttc" id="class_thing_speak_class_html_ad790afb71eb19b723c6fc2f17f8f4400"><div class="ttname"><a href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400">ThingSpeakClass::setLatitude</a></div><div class="ttdeci">int setLatitude(float latitude)</div><div class="ttdoc">Set the latitude of a multi-field update. To record latitude, longitude and elevation of a write...</div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:630</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a7375bc37b4cbf132751439f5fcafd1ba"><div class="ttname"><a href="class_thing_speak_class.html#a7375bc37b4cbf132751439f5fcafd1ba">ThingSpeakClass::begin</a></div><div class="ttdeci">bool begin(Client &amp;client, const char *customHostName, unsigned int port)</div><div class="ttdoc">Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak...</div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:165</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a549941b4b0000a2ba89de94f038ed577"><div class="ttname"><a href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577">ThingSpeakClass::getLastReadStatus</a></div><div class="ttdeci">int getLastReadStatus()</div><div class="ttdoc">Get the status of the previous read. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:1229</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a24fa89e20ef8b3314ad8270c1f81dd2d"><div class="ttname"><a href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">ThingSpeakClass::writeField</a></div><div class="ttdeci">int writeField(unsigned long channelNumber, unsigned int field, int value, const char *writeAPIKey)</div><div class="ttdoc">Write an integer value to a single field in a ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:257</div></div>
+<div class="ttc" id="class_thing_speak_class_html"><div class="ttname"><a href="class_thing_speak_class.html">ThingSpeakClass</a></div><div class="ttdoc">Enables an Arduino, ESP8266, Particle or other compatible hardware to write or read data to or from T...</div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:135</div></div>
+<div class="ttc" id="class_thing_speak_class_html_aff3c2e94e85da016fb8c82432e015d1b"><div class="ttname"><a href="class_thing_speak_class.html#aff3c2e94e85da016fb8c82432e015d1b">ThingSpeakClass::readLongField</a></div><div class="ttdeci">long readLongField(unsigned long channelNumber, unsigned int field, const char *readAPIKey)</div><div class="ttdoc">Read the latest long from a private ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:1034</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a91a8c326cb6a0b6fff38046cc90246ad"><div class="ttname"><a href="class_thing_speak_class.html#a91a8c326cb6a0b6fff38046cc90246ad">ThingSpeakClass::writeField</a></div><div class="ttdeci">int writeField(unsigned long channelNumber, unsigned int field, String value, const char *writeAPIKey)</div><div class="ttdoc">Write a String to a single field in a ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:371</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a46b7090f54ed4381ff825118d50db1fd"><div class="ttname"><a href="class_thing_speak_class.html#a46b7090f54ed4381ff825118d50db1fd">ThingSpeakClass::setField</a></div><div class="ttdeci">int setField(unsigned int field, const char *value)</div><div class="ttdoc">Set the value of a single field that will be part of a multi-field update. To write multiple fields a...</div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:544</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a578758c62a821dc9197ec6a3fdc0f7bc"><div class="ttname"><a href="class_thing_speak_class.html#a578758c62a821dc9197ec6a3fdc0f7bc">ThingSpeakClass::readRaw</a></div><div class="ttdeci">String readRaw(unsigned long channelNumber, String URLSuffix)</div><div class="ttdoc">Read a raw response from a public ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:1118</div></div>
+<div class="ttc" id="class_thing_speak_class_html_aa1660fbf6444ca06dc744a244905f6d9"><div class="ttname"><a href="class_thing_speak_class.html#aa1660fbf6444ca06dc744a244905f6d9">ThingSpeakClass::readLongField</a></div><div class="ttdeci">long readLongField(unsigned long channelNumber, unsigned int field)</div><div class="ttdoc">Read the latest long from a public ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:1055</div></div>
+<div class="ttc" id="class_thing_speak_class_html_af41b9c173128a898ba83220f52fb93ba"><div class="ttname"><a href="class_thing_speak_class.html#af41b9c173128a898ba83220f52fb93ba">ThingSpeakClass::writeField</a></div><div class="ttdeci">int writeField(unsigned long channelNumber, unsigned int field, float value, const char *writeAPIKey)</div><div class="ttdoc">Write a floating point value to a single field in a ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:309</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a1241ae5b3e08b1751495f2e45dabcc46"><div class="ttname"><a href="class_thing_speak_class.html#a1241ae5b3e08b1751495f2e45dabcc46">ThingSpeakClass::readIntField</a></div><div class="ttdeci">int readIntField(unsigned long channelNumber, unsigned int field, const char *readAPIKey)</div><div class="ttdoc">Read the latest int from a private ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:1077</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a5201062087f349e50a3dda7e48312850"><div class="ttname"><a href="class_thing_speak_class.html#a5201062087f349e50a3dda7e48312850">ThingSpeakClass::setField</a></div><div class="ttdeci">int setField(unsigned int field, String value)</div><div class="ttdoc">Set the value of a single field that will be part of a multi-field update. To write multiple fields a...</div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:580</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a8cb07c25c717a5acc5d8de60b19c0c3e"><div class="ttname"><a href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e">ThingSpeakClass::setLongitude</a></div><div class="ttdeci">int setLongitude(float longitude)</div><div class="ttdoc">Set the longitude of a multi-field update. To record latitude, longitude and elevation of a write...</div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:673</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a02cd79a65f1229711801fac5aec158b4"><div class="ttname"><a href="class_thing_speak_class.html#a02cd79a65f1229711801fac5aec158b4">ThingSpeakClass::readFloatField</a></div><div class="ttdeci">float readFloatField(unsigned long channelNumber, unsigned int field, const char *readAPIKey)</div><div class="ttdoc">Read the latest float from a private ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:992</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a92475d44f08bd87c798cff2e60491332"><div class="ttname"><a href="class_thing_speak_class.html#a92475d44f08bd87c798cff2e60491332">ThingSpeakClass::begin</a></div><div class="ttdeci">bool begin(Client &amp;client)</div><div class="ttdoc">Initializes the ThingSpeak library and network settings using the ThingSpeak.com service. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:229</div></div>
+<div class="ttc" id="class_thing_speak_class_html_ac65345864040b8f067a6d0e73a8dccfa"><div class="ttname"><a href="class_thing_speak_class.html#ac65345864040b8f067a6d0e73a8dccfa">ThingSpeakClass::readFloatField</a></div><div class="ttdeci">float readFloatField(unsigned long channelNumber, unsigned int field)</div><div class="ttdoc">Read the latest float from a public ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:1013</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a2e7a26e6bf7b65c0e8e53302787044e2"><div class="ttname"><a href="class_thing_speak_class.html#a2e7a26e6bf7b65c0e8e53302787044e2">ThingSpeakClass::writeField</a></div><div class="ttdeci">int writeField(unsigned long channelNumber, unsigned int field, const char *value, const char *writeAPIKey)</div><div class="ttdoc">Write a string to a single field in a ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:342</div></div>
+<div class="ttc" id="class_thing_speak_class_html_adb2ba704f38e591a6a391f7aa1850818"><div class="ttname"><a href="class_thing_speak_class.html#adb2ba704f38e591a6a391f7aa1850818">ThingSpeakClass::readIntField</a></div><div class="ttdeci">int readIntField(unsigned long channelNumber, unsigned int field)</div><div class="ttdoc">Read the latest int from a public ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:1098</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a5d3dfc59f211651ec7b1260e29921f45"><div class="ttname"><a href="class_thing_speak_class.html#a5d3dfc59f211651ec7b1260e29921f45">ThingSpeakClass::setField</a></div><div class="ttdeci">int setField(unsigned int field, float value)</div><div class="ttdoc">Set the value of a single field that will be part of a multi-field update. To write multiple fields a...</div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:504</div></div>
+<div class="ttc" id="class_thing_speak_class_html_abffced4cce37008c03c32d3feb38861d"><div class="ttname"><a href="class_thing_speak_class.html#abffced4cce37008c03c32d3feb38861d">ThingSpeakClass::readRaw</a></div><div class="ttdeci">String readRaw(unsigned long channelNumber, String URLSuffix, const char *readAPIKey)</div><div class="ttdoc">Read a raw response from a private ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:1139</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a1e9cc3c21e0a7360310aba628ef586c9"><div class="ttname"><a href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9">ThingSpeakClass::setElevation</a></div><div class="ttdeci">int setElevation(float elevation)</div><div class="ttdoc">Set the elevation of a multi-field update. To record latitude, longitude and elevation of a write...</div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:716</div></div>
+<div class="ttc" id="class_thing_speak_class_html_a3cc1f2fa986087cbc233a3f30d1dd957"><div class="ttname"><a href="class_thing_speak_class.html#a3cc1f2fa986087cbc233a3f30d1dd957">ThingSpeakClass::writeField</a></div><div class="ttdeci">int writeField(unsigned long channelNumber, unsigned int field, long value, const char *writeAPIKey)</div><div class="ttdoc">Write a long value to a single field in a ThingSpeak channel. </div><div class="ttdef"><b>Definition:</b> ThingSpeak.h:285</div></div>
+</div><!-- fragment --></div><!-- contents -->
+<!-- HTML footer for doxygen 1.8.9.1-->
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!-- start footer part -->
+<hr class="footer"/><address class="footer"><small>
+     <table border=0 width='100%'><tr>
+        <td align="left" width='50%'>
+          See the accompaning licence file for licensing information
+        </td>
+        <td align="right" width='50%'>
+          Copyright &copy; 2016 <a target=_top href=http://www.mathworks.com>The MathWorks, Inc.</a><br>
+        </td>
+      </tr></table>
+</small></address>
+</body>
+</html>
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/annotated.html
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/annotated.html	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/annotated.html	(revision 189)
@@ -0,0 +1,77 @@
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.9.1"/>
+<title>ThingSpeak Communication Library For Arduino, ESP8266, and Particle</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr style="height: 56px;">
+  <td style="padding-left: 0.5em;">
+   <div id="projectname">ThingSpeak Communication Library</div>
+   <div id="projectbrief">Enables an Arduino, ESP8266, or Particle to write or read data to or from ThingSpeak&trade;</div>
+  </td>
+  <td valign="middle" align="right" id="projectlogo"><img alt="Logo" src="ThingSpeakLogo.jpg"/></td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.9.1 -->
+  <div id="navrow1" class="tabs">
+    <ul class="tablist">
+      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
+      <li class="current"><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
+    </ul>
+  </div>
+  <div id="navrow2" class="tabs2">
+    <ul class="tablist">
+      <li class="current"><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
+      <li><a href="functions.html"><span>Data&#160;Fields</span></a></li>
+    </ul>
+  </div>
+</div><!-- top -->
+<div class="header">
+  <div class="headertitle">
+<div class="title">Data Structures</div>  </div>
+</div><!--header-->
+<div class="contents">
+<div class="textblock">Here are the data structures with brief descriptions:</div><div class="directory">
+<table class="directory">
+<tr id="row_0_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="class_thing_speak_class.html" target="_self">ThingSpeakClass</a></td><td class="desc">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 </td></tr>
+</table>
+</div><!-- directory -->
+</div><!-- contents -->
+<!-- HTML footer for doxygen 1.8.9.1-->
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!-- start footer part -->
+<hr class="footer"/><address class="footer"><small>
+     <table border=0 width='100%'><tr>
+        <td align="left" width='50%'>
+          See the accompaning licence file for licensing information
+        </td>
+        <td align="right" width='50%'>
+          Copyright &copy; 2016 <a target=_top href=http://www.mathworks.com>The MathWorks, Inc.</a><br>
+        </td>
+      </tr></table>
+</small></address>
+</body>
+</html>
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/class_thing_speak_class.html
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/class_thing_speak_class.html	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/class_thing_speak_class.html	(revision 189)
@@ -0,0 +1,1723 @@
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.9.1"/>
+<title>ThingSpeak Communication Library For Arduino, ESP8266, and Particle</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr style="height: 56px;">
+  <td style="padding-left: 0.5em;">
+   <div id="projectname">ThingSpeak Communication Library</div>
+   <div id="projectbrief">Enables an Arduino, ESP8266, or Particle to write or read data to or from ThingSpeak&trade;</div>
+  </td>
+  <td valign="middle" align="right" id="projectlogo"><img alt="Logo" src="ThingSpeakLogo.jpg"/></td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.9.1 -->
+  <div id="navrow1" class="tabs">
+    <ul class="tablist">
+      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
+      <li class="current"><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
+    </ul>
+  </div>
+  <div id="navrow2" class="tabs2">
+    <ul class="tablist">
+      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
+      <li><a href="functions.html"><span>Data&#160;Fields</span></a></li>
+    </ul>
+  </div>
+</div><!-- top -->
+<div class="header">
+  <div class="summary">
+<a href="#pub-methods">Public Member Functions</a>  </div>
+  <div class="headertitle">
+<div class="title">ThingSpeakClass Class Reference</div>  </div>
+</div><!--header-->
+<div class="contents">
+
+<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.  
+ <a href="class_thing_speak_class.html#details">More...</a></p>
+<table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
+Public Member Functions</h2></td></tr>
+<tr class="memitem:a7375bc37b4cbf132751439f5fcafd1ba"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a7375bc37b4cbf132751439f5fcafd1ba">begin</a> (Client &amp;client, const char *customHostName, unsigned int port)</td></tr>
+<tr class="memdesc:a7375bc37b4cbf132751439f5fcafd1ba"><td class="mdescLeft">&#160;</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>
+<tr class="separator:a7375bc37b4cbf132751439f5fcafd1ba"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a8bedb31c0f619bed57944aca13b423d7"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a8bedb31c0f619bed57944aca13b423d7">begin</a> (Client &amp;client, IPAddress customIP, unsigned int port)</td></tr>
+<tr class="memdesc:a8bedb31c0f619bed57944aca13b423d7"><td class="mdescLeft">&#160;</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>
+<tr class="separator:a8bedb31c0f619bed57944aca13b423d7"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a92475d44f08bd87c798cff2e60491332"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a92475d44f08bd87c798cff2e60491332">begin</a> (Client &amp;client)</td></tr>
+<tr class="memdesc:a92475d44f08bd87c798cff2e60491332"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the ThingSpeak library and network settings using the ThingSpeak.com service.  <a href="#a92475d44f08bd87c798cff2e60491332">More...</a><br /></td></tr>
+<tr class="separator:a92475d44f08bd87c798cff2e60491332"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a24fa89e20ef8b3314ad8270c1f81dd2d"><td class="memItemLeft" align="right" valign="top">int&#160;</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>
+<tr class="memdesc:a24fa89e20ef8b3314ad8270c1f81dd2d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write an integer value to a single field in a ThingSpeak channel.  <a href="#a24fa89e20ef8b3314ad8270c1f81dd2d">More...</a><br /></td></tr>
+<tr class="separator:a24fa89e20ef8b3314ad8270c1f81dd2d"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a3cc1f2fa986087cbc233a3f30d1dd957"><td class="memItemLeft" align="right" valign="top">int&#160;</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>
+<tr class="memdesc:a3cc1f2fa986087cbc233a3f30d1dd957"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write a long value to a single field in a ThingSpeak channel.  <a href="#a3cc1f2fa986087cbc233a3f30d1dd957">More...</a><br /></td></tr>
+<tr class="separator:a3cc1f2fa986087cbc233a3f30d1dd957"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:af41b9c173128a898ba83220f52fb93ba"><td class="memItemLeft" align="right" valign="top">int&#160;</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>
+<tr class="memdesc:af41b9c173128a898ba83220f52fb93ba"><td class="mdescLeft">&#160;</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>
+<tr class="separator:af41b9c173128a898ba83220f52fb93ba"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a2e7a26e6bf7b65c0e8e53302787044e2"><td class="memItemLeft" align="right" valign="top">int&#160;</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>
+<tr class="memdesc:a2e7a26e6bf7b65c0e8e53302787044e2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write a string to a single field in a ThingSpeak channel.  <a href="#a2e7a26e6bf7b65c0e8e53302787044e2">More...</a><br /></td></tr>
+<tr class="separator:a2e7a26e6bf7b65c0e8e53302787044e2"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a91a8c326cb6a0b6fff38046cc90246ad"><td class="memItemLeft" align="right" valign="top">int&#160;</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>
+<tr class="memdesc:a91a8c326cb6a0b6fff38046cc90246ad"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write a String to a single field in a ThingSpeak channel.  <a href="#a91a8c326cb6a0b6fff38046cc90246ad">More...</a><br /></td></tr>
+<tr class="separator:a91a8c326cb6a0b6fff38046cc90246ad"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a72eea45043ab45051c02593983d29546"><td class="memItemLeft" align="right" valign="top">int&#160;</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>
+<tr class="memdesc:a72eea45043ab45051c02593983d29546"><td class="mdescLeft">&#160;</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>
+<tr class="separator:a72eea45043ab45051c02593983d29546"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a8dba6e69d9cc12e5c5efe5043df02d81"><td class="memItemLeft" align="right" valign="top">int&#160;</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>
+<tr class="memdesc:a8dba6e69d9cc12e5c5efe5043df02d81"><td class="mdescLeft">&#160;</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>
+<tr class="separator:a8dba6e69d9cc12e5c5efe5043df02d81"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a5d3dfc59f211651ec7b1260e29921f45"><td class="memItemLeft" align="right" valign="top">int&#160;</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>
+<tr class="memdesc:a5d3dfc59f211651ec7b1260e29921f45"><td class="mdescLeft">&#160;</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>
+<tr class="separator:a5d3dfc59f211651ec7b1260e29921f45"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a46b7090f54ed4381ff825118d50db1fd"><td class="memItemLeft" align="right" valign="top">int&#160;</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>
+<tr class="memdesc:a46b7090f54ed4381ff825118d50db1fd"><td class="mdescLeft">&#160;</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>
+<tr class="separator:a46b7090f54ed4381ff825118d50db1fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a5201062087f349e50a3dda7e48312850"><td class="memItemLeft" align="right" valign="top">int&#160;</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>
+<tr class="memdesc:a5201062087f349e50a3dda7e48312850"><td class="mdescLeft">&#160;</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>
+<tr class="separator:a5201062087f349e50a3dda7e48312850"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ad790afb71eb19b723c6fc2f17f8f4400"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400">setLatitude</a> (float latitude)</td></tr>
+<tr class="memdesc:ad790afb71eb19b723c6fc2f17f8f4400"><td class="mdescLeft">&#160;</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>
+<tr class="separator:ad790afb71eb19b723c6fc2f17f8f4400"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a8cb07c25c717a5acc5d8de60b19c0c3e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e">setLongitude</a> (float longitude)</td></tr>
+<tr class="memdesc:a8cb07c25c717a5acc5d8de60b19c0c3e"><td class="mdescLeft">&#160;</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>
+<tr class="separator:a8cb07c25c717a5acc5d8de60b19c0c3e"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a1e9cc3c21e0a7360310aba628ef586c9"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9">setElevation</a> (float elevation)</td></tr>
+<tr class="memdesc:a1e9cc3c21e0a7360310aba628ef586c9"><td class="mdescLeft">&#160;</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>
+<tr class="separator:a1e9cc3c21e0a7360310aba628ef586c9"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a986d1958d5aa6705a53a31f3975f8cae"><td class="memItemLeft" align="right" valign="top">int&#160;</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>
+<tr class="memdesc:a986d1958d5aa6705a53a31f3975f8cae"><td class="mdescLeft">&#160;</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>
+<tr class="separator:a986d1958d5aa6705a53a31f3975f8cae"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a2a5333f683802cb455a3713d604abb84"><td class="memItemLeft" align="right" valign="top">int&#160;</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>
+<tr class="memdesc:a2a5333f683802cb455a3713d604abb84"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write a raw POST to a ThingSpeak channel.  <a href="#a2a5333f683802cb455a3713d604abb84">More...</a><br /></td></tr>
+<tr class="separator:a2a5333f683802cb455a3713d604abb84"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a7c3415bd86e0fa2c335d3b245912fb55"><td class="memItemLeft" align="right" valign="top">int&#160;</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>
+<tr class="memdesc:a7c3415bd86e0fa2c335d3b245912fb55"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write a raw POST to a ThingSpeak channel.  <a href="#a7c3415bd86e0fa2c335d3b245912fb55">More...</a><br /></td></tr>
+<tr class="separator:a7c3415bd86e0fa2c335d3b245912fb55"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:aa1534ea566b7f9fc951a41f8cf41f53b"><td class="memItemLeft" align="right" valign="top">String&#160;</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>
+<tr class="memdesc:aa1534ea566b7f9fc951a41f8cf41f53b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the latest string from a private ThingSpeak channel.  <a href="#aa1534ea566b7f9fc951a41f8cf41f53b">More...</a><br /></td></tr>
+<tr class="separator:aa1534ea566b7f9fc951a41f8cf41f53b"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a7ed5914c2f5c7d84672cdaae3547da96"><td class="memItemLeft" align="right" valign="top">String&#160;</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>
+<tr class="memdesc:a7ed5914c2f5c7d84672cdaae3547da96"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the latest string from a public ThingSpeak channel.  <a href="#a7ed5914c2f5c7d84672cdaae3547da96">More...</a><br /></td></tr>
+<tr class="separator:a7ed5914c2f5c7d84672cdaae3547da96"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a02cd79a65f1229711801fac5aec158b4"><td class="memItemLeft" align="right" valign="top">float&#160;</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>
+<tr class="memdesc:a02cd79a65f1229711801fac5aec158b4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the latest float from a private ThingSpeak channel.  <a href="#a02cd79a65f1229711801fac5aec158b4">More...</a><br /></td></tr>
+<tr class="separator:a02cd79a65f1229711801fac5aec158b4"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ac65345864040b8f067a6d0e73a8dccfa"><td class="memItemLeft" align="right" valign="top">float&#160;</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>
+<tr class="memdesc:ac65345864040b8f067a6d0e73a8dccfa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the latest float from a public ThingSpeak channel.  <a href="#ac65345864040b8f067a6d0e73a8dccfa">More...</a><br /></td></tr>
+<tr class="separator:ac65345864040b8f067a6d0e73a8dccfa"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:aff3c2e94e85da016fb8c82432e015d1b"><td class="memItemLeft" align="right" valign="top">long&#160;</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>
+<tr class="memdesc:aff3c2e94e85da016fb8c82432e015d1b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the latest long from a private ThingSpeak channel.  <a href="#aff3c2e94e85da016fb8c82432e015d1b">More...</a><br /></td></tr>
+<tr class="separator:aff3c2e94e85da016fb8c82432e015d1b"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:aa1660fbf6444ca06dc744a244905f6d9"><td class="memItemLeft" align="right" valign="top">long&#160;</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>
+<tr class="memdesc:aa1660fbf6444ca06dc744a244905f6d9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the latest long from a public ThingSpeak channel.  <a href="#aa1660fbf6444ca06dc744a244905f6d9">More...</a><br /></td></tr>
+<tr class="separator:aa1660fbf6444ca06dc744a244905f6d9"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a1241ae5b3e08b1751495f2e45dabcc46"><td class="memItemLeft" align="right" valign="top">int&#160;</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>
+<tr class="memdesc:a1241ae5b3e08b1751495f2e45dabcc46"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the latest int from a private ThingSpeak channel.  <a href="#a1241ae5b3e08b1751495f2e45dabcc46">More...</a><br /></td></tr>
+<tr class="separator:a1241ae5b3e08b1751495f2e45dabcc46"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:adb2ba704f38e591a6a391f7aa1850818"><td class="memItemLeft" align="right" valign="top">int&#160;</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>
+<tr class="memdesc:adb2ba704f38e591a6a391f7aa1850818"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the latest int from a public ThingSpeak channel.  <a href="#adb2ba704f38e591a6a391f7aa1850818">More...</a><br /></td></tr>
+<tr class="separator:adb2ba704f38e591a6a391f7aa1850818"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a578758c62a821dc9197ec6a3fdc0f7bc"><td class="memItemLeft" align="right" valign="top">String&#160;</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>
+<tr class="memdesc:a578758c62a821dc9197ec6a3fdc0f7bc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read a raw response from a public ThingSpeak channel.  <a href="#a578758c62a821dc9197ec6a3fdc0f7bc">More...</a><br /></td></tr>
+<tr class="separator:a578758c62a821dc9197ec6a3fdc0f7bc"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:abffced4cce37008c03c32d3feb38861d"><td class="memItemLeft" align="right" valign="top">String&#160;</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>
+<tr class="memdesc:abffced4cce37008c03c32d3feb38861d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read a raw response from a private ThingSpeak channel.  <a href="#abffced4cce37008c03c32d3feb38861d">More...</a><br /></td></tr>
+<tr class="separator:abffced4cce37008c03c32d3feb38861d"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a549941b4b0000a2ba89de94f038ed577"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577">getLastReadStatus</a> ()</td></tr>
+<tr class="memdesc:a549941b4b0000a2ba89de94f038ed577"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the status of the previous read.  <a href="#a549941b4b0000a2ba89de94f038ed577">More...</a><br /></td></tr>
+<tr class="separator:a549941b4b0000a2ba89de94f038ed577"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table>
+<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
+<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>
+</div><h2 class="groupheader">Member Function Documentation</h2>
+<a class="anchor" id="a7375bc37b4cbf132751439f5fcafd1ba"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">bool begin </td>
+          <td>(</td>
+          <td class="paramtype">Client &amp;&#160;</td>
+          <td class="paramname"><em>client</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>customHostName</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>port</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">client</td><td>EthernetClient, YunClient, TCPClient, or WiFiClient created earlier in the sketch </td></tr>
+    <tr><td class="paramname">customHostName</td><td>Host name of a custom install of ThingSpeak </td></tr>
+    <tr><td class="paramname">port</td><td>Port number to use with a custom install of ThingSpeak </td></tr>
+  </table>
+  </dd>
+</dl>
+<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 &lt;SPI.h&gt;</span></div>
+<div class="line"><span class="preprocessor">#include &lt;Ethernet.h&gt;</span></div>
+<div class="line">byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};</div>
+<div class="line">EthernetClient client;</div>
+<div class="line"></div>
+<div class="line"><span class="preprocessor">#include &quot;ThingSpeak.h&quot;</span></div>
+<div class="line"></div>
+<div class="line"><span class="keywordtype">void</span> setup() {</div>
+<div class="line">  Ethernet.begin(mac);</div>
+<div class="line">  ThingSpeak.<a class="code" href="class_thing_speak_class.html#a7375bc37b4cbf132751439f5fcafd1ba">begin</a>(client,<span class="stringliteral">&quot;api.thingspeak.com&quot;</span>, 80);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a8bedb31c0f619bed57944aca13b423d7"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">bool begin </td>
+          <td>(</td>
+          <td class="paramtype">Client &amp;&#160;</td>
+          <td class="paramname"><em>client</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">IPAddress&#160;</td>
+          <td class="paramname"><em>customIP</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>port</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">client</td><td>EthernetClient, YunClient, TCPClient, or WiFiClient created earlier in the sketch </td></tr>
+    <tr><td class="paramname">customIP</td><td>IP address of a custom install of ThingSpeak </td></tr>
+    <tr><td class="paramname">port</td><td>Port number to use with a custom install of ThingSpeak </td></tr>
+  </table>
+  </dd>
+</dl>
+<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 &lt;SPI.h&gt;</span></div>
+<div class="line"><span class="preprocessor">#include &lt;Ethernet.h&gt;</span></div>
+<div class="line">byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};</div>
+<div class="line">EthernetClient client;</div>
+<div class="line"></div>
+<div class="line"><span class="preprocessor">#include &quot;ThingSpeak.h&quot;</span></div>
+<div class="line"></div>
+<div class="line"><span class="keywordtype">void</span> setup() {</div>
+<div class="line">  Ethernet.begin(mac);</div>
+<div class="line">  ThingSpeak.<a class="code" href="class_thing_speak_class.html#a7375bc37b4cbf132751439f5fcafd1ba">begin</a>(client,IPAddress(184,106,153,149), 80);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a92475d44f08bd87c798cff2e60491332"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">bool begin </td>
+          <td>(</td>
+          <td class="paramtype">Client &amp;&#160;</td>
+          <td class="paramname"><em>client</em></td><td>)</td>
+          <td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Initializes the ThingSpeak library and network settings using the ThingSpeak.com service. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">client</td><td>EthernetClient, YunClient, TCPClient, or WiFiClient created earlier in the sketch </td></tr>
+  </table>
+  </dd>
+</dl>
+<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 &lt;SPI.h&gt;</span></div>
+<div class="line"><span class="preprocessor">#include &lt;Ethernet.h&gt;</span></div>
+<div class="line">byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};</div>
+<div class="line">EthernetClient client;</div>
+<div class="line"></div>
+<div class="line"><span class="preprocessor">#include &quot;ThingSpeak.h&quot;</span></div>
+<div class="line"></div>
+<div class="line"><span class="keywordtype">void</span> setup() {</div>
+<div class="line">  Ethernet.begin(mac);</div>
+<div class="line">  ThingSpeak.<a class="code" href="class_thing_speak_class.html#a7375bc37b4cbf132751439f5fcafd1ba">begin</a>(client);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a549941b4b0000a2ba89de94f038ed577"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int getLastReadStatus </td>
+          <td>(</td>
+          <td class="paramname"></td><td>)</td>
+          <td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Get the status of the previous read. </p>
+<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>
+<li>200: OK / Success</li>
+<li>404: Incorrect API key (or invalid ThingSpeak server address)</li>
+<li>-101: Value is out of range or string is too long (&gt; 255 characters)</li>
+<li>-201: Invalid field number specified</li>
+<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>
+<li>-301: Failed to connect to ThingSpeak</li>
+<li>-302: Unexpected failure during write to ThingSpeak</li>
+<li>-303: Unable to parse response</li>
+<li>-304: Timeout waiting for server to respond</li>
+<li>-401: Point was not inserted (most probable cause is the rate limit of once every 15 seconds) </li>
+</ul>
+</dd></dl>
+<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>
+<div class="line">  String message = ThingSpeak.<a class="code" href="class_thing_speak_class.html#aa1534ea566b7f9fc951a41f8cf41f53b">readStringField</a>(myChannelNumber, 1);</div>
+<div class="line">  <span class="keywordtype">int</span> resultCode = ThingSpeak.<a class="code" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577">getLastReadStatus</a>();</div>
+<div class="line">  <span class="keywordflow">if</span>(resultCode == 200)</div>
+<div class="line">  {</div>
+<div class="line">     Serial.print(<span class="stringliteral">&quot;Latest message is: &quot;</span>); </div>
+<div class="line">     Serial.println(message);</div>
+<div class="line">  }</div>
+<div class="line">  <span class="keywordflow">else</span></div>
+<div class="line">  {</div>
+<div class="line">     Serial.print(<span class="stringliteral">&quot;Error reading message.  Status was: &quot;</span>); </div>
+<div class="line">     Serial.println(resultCode);</div>
+<div class="line">  }</div>
+<div class="line">  delay(30000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a02cd79a65f1229711801fac5aec158b4"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">float readFloatField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>readAPIKey</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Read the latest float from a private ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to read from. </td></tr>
+    <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>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">  Serial.print(<span class="stringliteral">&quot;Latest voltage is: &quot;</span>); </div>
+<div class="line">  Serial.print(voltage);</div>
+<div class="line">  Serial.println(<span class="stringliteral">&quot;V&quot;</span>); </div>
+<div class="line">  delay(30000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ac65345864040b8f067a6d0e73a8dccfa"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">float readFloatField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Read the latest float from a public ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to read from. </td></tr>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">  Serial.print(<span class="stringliteral">&quot;Latest voltage is: &quot;</span>); </div>
+<div class="line">  Serial.print(voltage);</div>
+<div class="line">  Serial.println(<span class="stringliteral">&quot;V&quot;</span>); </div>
+<div class="line">  delay(30000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a1241ae5b3e08b1751495f2e45dabcc46"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int readIntField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>readAPIKey</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Read the latest int from a private ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to read from. </td></tr>
+    <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>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<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>
+<div class="line">  Serial.print(<span class="stringliteral">&quot;Latest value is: &quot;</span>); </div>
+<div class="line">  Serial.print(value);</div>
+<div class="line">  delay(30000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="adb2ba704f38e591a6a391f7aa1850818"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int readIntField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Read the latest int from a public ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to read from. </td></tr>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<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>
+<div class="line">  Serial.print(<span class="stringliteral">&quot;Latest value is: &quot;</span>); </div>
+<div class="line">  Serial.print(value);</div>
+<div class="line">  delay(30000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="aff3c2e94e85da016fb8c82432e015d1b"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">long readLongField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>readAPIKey</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Read the latest long from a private ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to read from. </td></tr>
+    <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>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">  Serial.print(<span class="stringliteral">&quot;Latest value is: &quot;</span>); </div>
+<div class="line">  Serial.print(value);</div>
+<div class="line">  delay(30000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="aa1660fbf6444ca06dc744a244905f6d9"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">long readLongField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Read the latest long from a public ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to read from. </td></tr>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">  Serial.print(<span class="stringliteral">&quot;Latest value is: &quot;</span>); </div>
+<div class="line">  Serial.print(value);</div>
+<div class="line">  delay(30000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a578758c62a821dc9197ec6a3fdc0f7bc"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">String readRaw </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">String&#160;</td>
+          <td class="paramname"><em>URLSuffix</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Read a raw response from a public ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <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>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">  String response = ThingSpeak.<a class="code" href="class_thing_speak_class.html#a578758c62a821dc9197ec6a3fdc0f7bc">readRaw</a>(myChannelNumber, String(<span class="stringliteral">&quot;feeds/days=1&quot;</span>));</div>
+<div class="line">  Serial.print(<span class="stringliteral">&quot;Response: &quot;</span>); </div>
+<div class="line">  Serial.print(response);</div>
+<div class="line">  delay(30000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="abffced4cce37008c03c32d3feb38861d"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">String readRaw </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">String&#160;</td>
+          <td class="paramname"><em>URLSuffix</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>readAPIKey</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Read a raw response from a private ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <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>
+    <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>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">  String response = ThingSpeak.<a class="code" href="class_thing_speak_class.html#a578758c62a821dc9197ec6a3fdc0f7bc">readRaw</a>(myChannelNumber, String(<span class="stringliteral">&quot;feeds/days=1&quot;</span>), myReadAPIKey);</div>
+<div class="line">  Serial.print(<span class="stringliteral">&quot;Response: &quot;</span>); </div>
+<div class="line">  Serial.print(response);</div>
+<div class="line">  delay(30000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="aa1534ea566b7f9fc951a41f8cf41f53b"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">String readStringField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>readAPIKey</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Read the latest string from a private ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to read from. </td></tr>
+    <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>
+  </table>
+  </dd>
+</dl>
+<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>
+<div class="line">  String message = ThingSpeak.<a class="code" href="class_thing_speak_class.html#aa1534ea566b7f9fc951a41f8cf41f53b">readStringField</a>(myChannelNumber, 1, myReadAPIKey);</div>
+<div class="line">  Serial.print(<span class="stringliteral">&quot;Latest message is: &quot;</span>); </div>
+<div class="line">  Serial.println(message);</div>
+<div class="line">  delay(30000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a7ed5914c2f5c7d84672cdaae3547da96"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">String readStringField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Read the latest string from a public ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to read from. </td></tr>
+  </table>
+  </dd>
+</dl>
+<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>
+<div class="line">  String message = ThingSpeak.<a class="code" href="class_thing_speak_class.html#aa1534ea566b7f9fc951a41f8cf41f53b">readStringField</a>(myChannelNumber, 1);</div>
+<div class="line">  Serial.print(<span class="stringliteral">&quot;Latest message is: &quot;</span>); </div>
+<div class="line">  Serial.println(message);</div>
+<div class="line">  delay(30000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a1e9cc3c21e0a7360310aba628ef586c9"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int setElevation </td>
+          <td>(</td>
+          <td class="paramtype">float&#160;</td>
+          <td class="paramname"><em>elevation</em></td><td>)</td>
+          <td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<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>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">elevation</td><td>Elevation of the measurement (meters above sea level) </td></tr>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">   <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
+<div class="line">   <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
+<div class="line">   String sensor3Meaning;</div>
+<div class="line">   <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
+<div class="line">   <span class="keywordflow">if</span> (sensor3Value &lt; 400) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Cold!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value &gt; 600) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Hot!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Just Right&quot;</span>);</div>
+<div class="line">   }</div>
+<div class="line">   <span class="keywordtype">long</span> timeRead = millis();</div>
+<div class="line"></div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
+<div class="line">   <a class="code" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400">setLatitude</a>(42.2833);</div>
+<div class="line">   <a class="code" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e">setLongitude</a>(-71.3500);</div>
+<div class="line">   <a class="code" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9">setElevation</a>(100);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
+<div class="line">   delay(20000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a72eea45043ab45051c02593983d29546"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int setField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">int&#160;</td>
+          <td class="paramname"><em>value</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<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>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to set </td></tr>
+    <tr><td class="paramname">value</td><td>Integer value (from -32,768 to 32,767) to set. </td></tr>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">   <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
+<div class="line">   <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
+<div class="line">   String sensor3Meaning;</div>
+<div class="line">   <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
+<div class="line">   <span class="keywordflow">if</span> (sensor3Value &lt; 400) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Cold!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value &gt; 600) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Hot!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Just Right&quot;</span>);</div>
+<div class="line">   }</div>
+<div class="line">   <span class="keywordtype">long</span> timeRead = millis();</div>
+<div class="line"></div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
+<div class="line">   delay(20000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a8dba6e69d9cc12e5c5efe5043df02d81"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int setField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">long&#160;</td>
+          <td class="paramname"><em>value</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<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>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to set </td></tr>
+    <tr><td class="paramname">value</td><td>Long value (from -2,147,483,648 to 2,147,483,647) to write. </td></tr>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">   <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
+<div class="line">   <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
+<div class="line">   String sensor3Meaning;</div>
+<div class="line">   <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
+<div class="line">   <span class="keywordflow">if</span> (sensor3Value &lt; 400) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Cold!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value &gt; 600) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Hot!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Just Right&quot;</span>);</div>
+<div class="line">   }</div>
+<div class="line">   <span class="keywordtype">long</span> timeRead = millis();</div>
+<div class="line"></div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
+<div class="line">   delay(20000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a5d3dfc59f211651ec7b1260e29921f45"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int setField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">float&#160;</td>
+          <td class="paramname"><em>value</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<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>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to set </td></tr>
+    <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>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">   <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
+<div class="line">   <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
+<div class="line">   String sensor3Meaning;</div>
+<div class="line">   <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
+<div class="line">   <span class="keywordflow">if</span> (sensor3Value &lt; 400) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Cold!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value &gt; 600) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Hot!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Just Right&quot;</span>);</div>
+<div class="line">   }</div>
+<div class="line">   <span class="keywordtype">long</span> timeRead = millis();</div>
+<div class="line"></div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
+<div class="line">   delay(20000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a46b7090f54ed4381ff825118d50db1fd"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int setField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>value</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<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>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to set </td></tr>
+    <tr><td class="paramname">value</td><td>String to write (UTF8). ThingSpeak limits this to 255 bytes. </td></tr>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">   <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
+<div class="line">   <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
+<div class="line">   String sensor3Meaning;</div>
+<div class="line">   <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
+<div class="line">   <span class="keywordflow">if</span> (sensor3Value &lt; 400) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Cold!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value &gt; 600) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Hot!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Just Right&quot;</span>);</div>
+<div class="line">   }</div>
+<div class="line">   <span class="keywordtype">long</span> timeRead = millis();</div>
+<div class="line"></div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
+<div class="line">   delay(20000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a5201062087f349e50a3dda7e48312850"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int setField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">String&#160;</td>
+          <td class="paramname"><em>value</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<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>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to set </td></tr>
+    <tr><td class="paramname">value</td><td>String to write (UTF8). ThingSpeak limits this to 255 bytes. </td></tr>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">   <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
+<div class="line">   <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
+<div class="line">   String sensor3Meaning;</div>
+<div class="line">   <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
+<div class="line">   <span class="keywordflow">if</span> (sensor3Value &lt; 400) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Cold!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value &gt; 600) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Hot!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Just Right&quot;</span>);</div>
+<div class="line">   }</div>
+<div class="line">   <span class="keywordtype">long</span> timeRead = millis();</div>
+<div class="line"></div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
+<div class="line">   delay(20000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ad790afb71eb19b723c6fc2f17f8f4400"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int setLatitude </td>
+          <td>(</td>
+          <td class="paramtype">float&#160;</td>
+          <td class="paramname"><em>latitude</em></td><td>)</td>
+          <td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<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>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">latitude</td><td>Latitude of the measurement (degrees N, use negative values for degrees S) </td></tr>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">   <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
+<div class="line">   <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
+<div class="line">   String sensor3Meaning;</div>
+<div class="line">   <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
+<div class="line">   <span class="keywordflow">if</span> (sensor3Value &lt; 400) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Cold!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value &gt; 600) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Hot!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Just Right&quot;</span>);</div>
+<div class="line">   }</div>
+<div class="line">   <span class="keywordtype">long</span> timeRead = millis();</div>
+<div class="line"></div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
+<div class="line">   <a class="code" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400">setLatitude</a>(42.2833);</div>
+<div class="line">   <a class="code" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e">setLongitude</a>(-71.3500);</div>
+<div class="line">   <a class="code" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9">setElevation</a>(100);</div>
+<div class="line">   delay(20000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a8cb07c25c717a5acc5d8de60b19c0c3e"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int setLongitude </td>
+          <td>(</td>
+          <td class="paramtype">float&#160;</td>
+          <td class="paramname"><em>longitude</em></td><td>)</td>
+          <td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<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>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">longitude</td><td>Longitude of the measurement (degrees E, use negative values for degrees W) </td></tr>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">   <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
+<div class="line">   <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
+<div class="line">   String sensor3Meaning;</div>
+<div class="line">   <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
+<div class="line">   <span class="keywordflow">if</span> (sensor3Value &lt; 400) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Cold!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value &gt; 600) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Hot!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Just Right&quot;</span>);</div>
+<div class="line">   }</div>
+<div class="line">   <span class="keywordtype">long</span> timeRead = millis();</div>
+<div class="line"></div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
+<div class="line">   <a class="code" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400">setLatitude</a>(42.2833);</div>
+<div class="line">   <a class="code" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e">setLongitude</a>(-71.3500);</div>
+<div class="line">   <a class="code" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9">setElevation</a>(100);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
+<div class="line">   delay(20000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a24fa89e20ef8b3314ad8270c1f81dd2d"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int writeField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">int&#160;</td>
+          <td class="paramname"><em>value</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>writeAPIKey</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Write an integer value to a single field in a ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to write to. </td></tr>
+    <tr><td class="paramname">value</td><td>Integer value (from -32,768 to 32,767) to write. </td></tr>
+    <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>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">   <span class="keywordtype">int</span> sensorValue = analogRead(A0);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(myChannelNumber, 1, sensorValue, myWriteAPIKey);</div>
+<div class="line">   delay(20000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a3cc1f2fa986087cbc233a3f30d1dd957"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int writeField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">long&#160;</td>
+          <td class="paramname"><em>value</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>writeAPIKey</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Write a long value to a single field in a ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to write to. </td></tr>
+    <tr><td class="paramname">value</td><td>Long value (from -2,147,483,648 to 2,147,483,647) to write. </td></tr>
+    <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>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">   <span class="keywordtype">int</span> sensorValue = analogRead(A0);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(myChannelNumber, 1, sensorValue, myWriteAPIKey);</div>
+<div class="line">   delay(20000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="af41b9c173128a898ba83220f52fb93ba"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int writeField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">float&#160;</td>
+          <td class="paramname"><em>value</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>writeAPIKey</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Write a floating point value to a single field in a ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to write to. </td></tr>
+    <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>
+    <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>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">   <span class="keywordtype">int</span> sensorValue = analogRead(A0);</div>
+<div class="line">   <span class="keywordtype">float</span> voltage = sensorValue * (5.0 / 1023.0);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(myChannelNumber, 1, voltage, myWriteAPIKey);</div>
+<div class="line">   delay(20000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a2e7a26e6bf7b65c0e8e53302787044e2"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int writeField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>value</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>writeAPIKey</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Write a string to a single field in a ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to write to. </td></tr>
+    <tr><td class="paramname">value</td><td>String to write (UTF8 string). ThingSpeak limits this field to 255 bytes. </td></tr>
+    <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>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">   <span class="keywordtype">int</span> sensorValue = analogRead(A0);</div>
+<div class="line">   <span class="keywordflow">if</span> (sensorValue &gt; 512) {</div>
+<div class="line">       ThingSpeak.<a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(myChannelNumber, 1, <span class="stringliteral">&quot;High&quot;</span>, myWriteAPIKey);</div>
+<div class="line">   }</div>
+<div class="line">   <span class="keywordflow">else</span> {</div>
+<div class="line">       ThingSpeak.<a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(myChannelNumber, 1, <span class="stringliteral">&quot;Low&quot;</span>, myWriteAPIKey);</div>
+<div class="line">   }</div>
+<div class="line">   delay(20000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a91a8c326cb6a0b6fff38046cc90246ad"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int writeField </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">unsigned int&#160;</td>
+          <td class="paramname"><em>field</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">String&#160;</td>
+          <td class="paramname"><em>value</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>writeAPIKey</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Write a String to a single field in a ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <tr><td class="paramname">field</td><td>Field number (1-8) within the channel to write to. </td></tr>
+    <tr><td class="paramname">value</td><td>Character array (zero terminated) to write (UTF8). ThingSpeak limits this field to 255 bytes. </td></tr>
+    <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>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">   <span class="keywordtype">int</span> sensorValue = analogRead(A0);</div>
+<div class="line">   String meaning;</div>
+<div class="line">   <span class="keywordflow">if</span> (sensorValue &lt; 400) {</div>
+<div class="line">       meaning = String(<span class="stringliteral">&quot;Too Cold!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensorValue &gt; 600) {</div>
+<div class="line">       meaning = String(<span class="stringliteral">&quot;Too Hot!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> {</div>
+<div class="line">       meaning = String(<span class="stringliteral">&quot;Just Right&quot;</span>);</div>
+<div class="line">   }</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">writeField</a>(myChannelNumber, 1, meaning, myWriteAPIKey);</div>
+<div class="line">   delay(20000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a986d1958d5aa6705a53a31f3975f8cae"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int writeFields </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>writeAPIKey</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<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>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <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>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">   <span class="keywordtype">int</span> sensor1Value = analogRead(A0);</div>
+<div class="line">   <span class="keywordtype">float</span> sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);</div>
+<div class="line">   String sensor3Meaning;</div>
+<div class="line">   <span class="keywordtype">int</span> sensor3Value = analogRead(A2);</div>
+<div class="line">   <span class="keywordflow">if</span> (sensor3Value &lt; 400) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Cold!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sensor3Value &gt; 600) {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Too Hot!&quot;</span>);</div>
+<div class="line">   } <span class="keywordflow">else</span> {</div>
+<div class="line">       sensor3Meaning = String(<span class="stringliteral">&quot;Just Right&quot;</span>);</div>
+<div class="line">   }</div>
+<div class="line">   <span class="keywordtype">long</span> timeRead = millis();</div>
+<div class="line"></div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
+<div class="line">   <a class="code" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400">setLatitude</a>(42.2833);</div>
+<div class="line">   <a class="code" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e">setLongitude</a>(-71.3500);</div>
+<div class="line">   <a class="code" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9">setElevation</a>(100);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
+<div class="line">   delay(20000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a2a5333f683802cb455a3713d604abb84"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int writeRaw </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>postMessage</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>writeAPIKey</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Write a raw POST to a ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <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>
+    <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>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">   <span class="keyword">const</span> <span class="keywordtype">char</span> postMessage[] = <span class="stringliteral">&quot;field1=23&amp;created_at=2014-12-31%2023:59:59&quot;</span>;</div>
+<div class="line"></div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(1, sensor1Value);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(2, sensor2Voltage);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(3, sensor3Meaning);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">setField</a>(4, timeRead);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">writeFields</a>(myChannelNumber, myWriteAPIKey);</div>
+<div class="line">   delay(20000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a7c3415bd86e0fa2c335d3b245912fb55"></a>
+<div class="memitem">
+<div class="memproto">
+      <table class="memname">
+        <tr>
+          <td class="memname">int writeRaw </td>
+          <td>(</td>
+          <td class="paramtype">unsigned long&#160;</td>
+          <td class="paramname"><em>channelNumber</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">String&#160;</td>
+          <td class="paramname"><em>postMessage</em>, </td>
+        </tr>
+        <tr>
+          <td class="paramkey"></td>
+          <td></td>
+          <td class="paramtype">const char *&#160;</td>
+          <td class="paramname"><em>writeAPIKey</em>&#160;</td>
+        </tr>
+        <tr>
+          <td></td>
+          <td>)</td>
+          <td></td><td></td>
+        </tr>
+      </table>
+</div><div class="memdoc">
+
+<p>Write a raw POST to a ThingSpeak channel. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+  <table class="params">
+    <tr><td class="paramname">channelNumber</td><td>Channel number </td></tr>
+    <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>
+    <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>
+  </table>
+  </dd>
+</dl>
+<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>
+<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>
+<div class="line">   String postMessage = String(<span class="stringliteral">&quot;field1=23&amp;created_at=2014-12-31%2023:59:59&quot;</span>);</div>
+<div class="line">   ThingSpeak.<a class="code" href="class_thing_speak_class.html#a2a5333f683802cb455a3713d604abb84">writeRaw</a>(myChannelNumber, postMessage, myWriteAPIKey);</div>
+<div class="line">   delay(20000);</div>
+<div class="line">}</div>
+</div><!-- fragment --> </dd></dl>
+
+</div>
+</div>
+</div><!-- contents -->
+<!-- HTML footer for doxygen 1.8.9.1-->
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!-- start footer part -->
+<hr class="footer"/><address class="footer"><small>
+     <table border=0 width='100%'><tr>
+        <td align="left" width='50%'>
+          See the accompaning licence file for licensing information
+        </td>
+        <td align="right" width='50%'>
+          Copyright &copy; 2016 <a target=_top href=http://www.mathworks.com>The MathWorks, Inc.</a><br>
+        </td>
+      </tr></table>
+</small></address>
+</body>
+</html>
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/classes.html
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/classes.html	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/classes.html	(revision 189)
@@ -0,0 +1,81 @@
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.9.1"/>
+<title>ThingSpeak Communication Library For Arduino, ESP8266, and Particle</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr style="height: 56px;">
+  <td style="padding-left: 0.5em;">
+   <div id="projectname">ThingSpeak Communication Library</div>
+   <div id="projectbrief">Enables an Arduino, ESP8266, or Particle to write or read data to or from ThingSpeak&trade;</div>
+  </td>
+  <td valign="middle" align="right" id="projectlogo"><img alt="Logo" src="ThingSpeakLogo.jpg"/></td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.9.1 -->
+  <div id="navrow1" class="tabs">
+    <ul class="tablist">
+      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
+      <li class="current"><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
+    </ul>
+  </div>
+  <div id="navrow2" class="tabs2">
+    <ul class="tablist">
+      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
+      <li><a href="functions.html"><span>Data&#160;Fields</span></a></li>
+    </ul>
+  </div>
+</div><!-- top -->
+<div class="header">
+  <div class="headertitle">
+<div class="title">Data Structure Index</div>  </div>
+</div><!--header-->
+<div class="contents">
+<div class="qindex"><a class="qindex" href="#letter_T">T</a></div>
+<table style="margin: 10px; white-space: nowrap;" align="center" width="95%" border="0" cellspacing="0" cellpadding="0">
+<tr><td rowspan="2" valign="bottom"><a name="letter_T"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;T&#160;&#160;</div></td></tr></table>
+</td><td></td></tr>
+<tr><td></td></tr>
+<tr><td valign="top"><a class="el" href="class_thing_speak_class.html">ThingSpeakClass</a>&#160;&#160;&#160;</td><td></td></tr>
+<tr><td></td><td></td></tr>
+</table>
+<div class="qindex"><a class="qindex" href="#letter_T">T</a></div>
+</div><!-- contents -->
+<!-- HTML footer for doxygen 1.8.9.1-->
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!-- start footer part -->
+<hr class="footer"/><address class="footer"><small>
+     <table border=0 width='100%'><tr>
+        <td align="left" width='50%'>
+          See the accompaning licence file for licensing information
+        </td>
+        <td align="right" width='50%'>
+          Copyright &copy; 2016 <a target=_top href=http://www.mathworks.com>The MathWorks, Inc.</a><br>
+        </td>
+      </tr></table>
+</small></address>
+</body>
+</html>
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/dir_339e8c1d13ed9d171a31356d80f51341.html
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/dir_339e8c1d13ed9d171a31356d80f51341.html	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/dir_339e8c1d13ed9d171a31356d80f51341.html	(revision 189)
@@ -0,0 +1,76 @@
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.9.1"/>
+<title>ThingSpeak Communication Library For Arduino, ESP8266, and Particle</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr style="height: 56px;">
+  <td style="padding-left: 0.5em;">
+   <div id="projectname">ThingSpeak Communication Library</div>
+   <div id="projectbrief">Enables an Arduino, ESP8266, or Particle to write or read data to or from ThingSpeak&trade;</div>
+  </td>
+  <td valign="middle" align="right" id="projectlogo"><img alt="Logo" src="ThingSpeakLogo.jpg"/></td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.9.1 -->
+  <div id="navrow1" class="tabs">
+    <ul class="tablist">
+      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
+      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
+    </ul>
+  </div>
+<div id="nav-path" class="navpath">
+  <ul>
+<li class="navelem"><a class="el" href="dir_339e8c1d13ed9d171a31356d80f51341.html">ThingSpeak</a></li>  </ul>
+</div>
+</div><!-- top -->
+<div class="header">
+  <div class="headertitle">
+<div class="title">ThingSpeak Directory Reference</div>  </div>
+</div><!--header-->
+<div class="contents">
+<table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="subdirs"></a>
+Directories</h2></td></tr>
+<tr class="memitem:dir_9eb8a1162b9e86c4bf1f8e762bfe83d1"><td class="memItemLeft" align="right" valign="top">directory &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dir_9eb8a1162b9e86c4bf1f8e762bfe83d1.html">src</a></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table>
+</div><!-- contents -->
+<!-- HTML footer for doxygen 1.8.9.1-->
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!-- start footer part -->
+<hr class="footer"/><address class="footer"><small>
+     <table border=0 width='100%'><tr>
+        <td align="left" width='50%'>
+          See the accompaning licence file for licensing information
+        </td>
+        <td align="right" width='50%'>
+          Copyright &copy; 2016 <a target=_top href=http://www.mathworks.com>The MathWorks, Inc.</a><br>
+        </td>
+      </tr></table>
+</small></address>
+</body>
+</html>
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/dir_9eb8a1162b9e86c4bf1f8e762bfe83d1.html
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/dir_9eb8a1162b9e86c4bf1f8e762bfe83d1.html	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/dir_9eb8a1162b9e86c4bf1f8e762bfe83d1.html	(revision 189)
@@ -0,0 +1,78 @@
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.9.1"/>
+<title>ThingSpeak Communication Library For Arduino, ESP8266, and Particle</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr style="height: 56px;">
+  <td style="padding-left: 0.5em;">
+   <div id="projectname">ThingSpeak Communication Library</div>
+   <div id="projectbrief">Enables an Arduino, ESP8266, or Particle to write or read data to or from ThingSpeak&trade;</div>
+  </td>
+  <td valign="middle" align="right" id="projectlogo"><img alt="Logo" src="ThingSpeakLogo.jpg"/></td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.9.1 -->
+  <div id="navrow1" class="tabs">
+    <ul class="tablist">
+      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
+      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
+    </ul>
+  </div>
+<div id="nav-path" class="navpath">
+  <ul>
+<li class="navelem"><a class="el" href="dir_339e8c1d13ed9d171a31356d80f51341.html">ThingSpeak</a></li><li class="navelem"><a class="el" href="dir_9eb8a1162b9e86c4bf1f8e762bfe83d1.html">src</a></li>  </ul>
+</div>
+</div><!-- top -->
+<div class="header">
+  <div class="headertitle">
+<div class="title">src Directory Reference</div>  </div>
+</div><!--header-->
+<div class="contents">
+<table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="files"></a>
+Files</h2></td></tr>
+<tr class="memitem:_thing_speak_8cpp"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>ThingSpeak.cpp</b></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:_thing_speak_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>ThingSpeak.h</b> <a href="_thing_speak_8h_source.html">[code]</a></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table>
+</div><!-- contents -->
+<!-- HTML footer for doxygen 1.8.9.1-->
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!-- start footer part -->
+<hr class="footer"/><address class="footer"><small>
+     <table border=0 width='100%'><tr>
+        <td align="left" width='50%'>
+          See the accompaning licence file for licensing information
+        </td>
+        <td align="right" width='50%'>
+          Copyright &copy; 2016 <a target=_top href=http://www.mathworks.com>The MathWorks, Inc.</a><br>
+        </td>
+      </tr></table>
+</small></address>
+</body>
+</html>
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/doxygen.css
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/doxygen.css	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/doxygen.css	(revision 189)
@@ -0,0 +1,1449 @@
+/* The standard CSS for doxygen 1.8.9.1 */
+
+body, table, div, p, dl {
+	font: 400 14px/22px Roboto,sans-serif;
+}
+
+/* @group Heading Levels */
+
+h1.groupheader {
+	font-size: 150%;
+}
+
+.title {
+	font: 400 14px/28px Roboto,sans-serif;
+	font-size: 150%;
+	font-weight: bold;
+	margin: 10px 2px;
+}
+
+h2.groupheader {
+	border-bottom: 1px solid #879ECB;
+	color: #354C7B;
+	font-size: 150%;
+	font-weight: normal;
+	margin-top: 1.75em;
+	padding-top: 8px;
+	padding-bottom: 4px;
+	width: 100%;
+}
+
+h3.groupheader {
+	font-size: 100%;
+}
+
+h1, h2, h3, h4, h5, h6 {
+	-webkit-transition: text-shadow 0.5s linear;
+	-moz-transition: text-shadow 0.5s linear;
+	-ms-transition: text-shadow 0.5s linear;
+	-o-transition: text-shadow 0.5s linear;
+	transition: text-shadow 0.5s linear;
+	margin-right: 15px;
+}
+
+h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow {
+	text-shadow: 0 0 15px cyan;
+}
+
+dt {
+	font-weight: bold;
+}
+
+div.multicol {
+	-moz-column-gap: 1em;
+	-webkit-column-gap: 1em;
+	-moz-column-count: 3;
+	-webkit-column-count: 3;
+}
+
+p.startli, p.startdd {
+	margin-top: 2px;
+}
+
+p.starttd {
+	margin-top: 0px;
+}
+
+p.endli {
+	margin-bottom: 0px;
+}
+
+p.enddd {
+	margin-bottom: 4px;
+}
+
+p.endtd {
+	margin-bottom: 2px;
+}
+
+/* @end */
+
+caption {
+	font-weight: bold;
+}
+
+span.legend {
+        font-size: 70%;
+        text-align: center;
+}
+
+h3.version {
+        font-size: 90%;
+        text-align: center;
+}
+
+div.qindex, div.navtab{
+	background-color: #EBEFF6;
+	border: 1px solid #A3B4D7;
+	text-align: center;
+}
+
+div.qindex, div.navpath {
+	width: 100%;
+	line-height: 140%;
+}
+
+div.navtab {
+	margin-right: 15px;
+}
+
+/* @group Link Styling */
+
+a {
+	color: #3D578C;
+	font-weight: normal;
+	text-decoration: none;
+}
+
+.contents a:visited {
+	color: #4665A2;
+}
+
+a:hover {
+	text-decoration: underline;
+}
+
+a.qindex {
+	font-weight: bold;
+}
+
+a.qindexHL {
+	font-weight: bold;
+	background-color: #9CAFD4;
+	color: #ffffff;
+	border: 1px double #869DCA;
+}
+
+.contents a.qindexHL:visited {
+        color: #ffffff;
+}
+
+a.el {
+	font-weight: bold;
+}
+
+a.elRef {
+}
+
+a.code, a.code:visited, a.line, a.line:visited {
+	color: #4665A2; 
+}
+
+a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited {
+	color: #4665A2; 
+}
+
+/* @end */
+
+dl.el {
+	margin-left: -1cm;
+}
+
+pre.fragment {
+        border: 1px solid #C4CFE5;
+        background-color: #FBFCFD;
+        padding: 4px 6px;
+        margin: 4px 8px 4px 2px;
+        overflow: auto;
+        word-wrap: break-word;
+        font-size:  9pt;
+        line-height: 125%;
+        font-family: monospace, fixed;
+        font-size: 105%;
+}
+
+div.fragment {
+        padding: 4px 6px;
+        margin: 4px 8px 4px 2px;
+	background-color: #FBFCFD;
+	border: 1px solid #C4CFE5;
+}
+
+div.line {
+	font-family: monospace, fixed;
+        font-size: 13px;
+	min-height: 13px;
+	line-height: 1.0;
+	text-wrap: unrestricted;
+	white-space: -moz-pre-wrap; /* Moz */
+	white-space: -pre-wrap;     /* Opera 4-6 */
+	white-space: -o-pre-wrap;   /* Opera 7 */
+	white-space: pre-wrap;      /* CSS3  */
+	word-wrap: break-word;      /* IE 5.5+ */
+	text-indent: -53px;
+	padding-left: 53px;
+	padding-bottom: 0px;
+	margin: 0px;
+	-webkit-transition-property: background-color, box-shadow;
+	-webkit-transition-duration: 0.5s;
+	-moz-transition-property: background-color, box-shadow;
+	-moz-transition-duration: 0.5s;
+	-ms-transition-property: background-color, box-shadow;
+	-ms-transition-duration: 0.5s;
+	-o-transition-property: background-color, box-shadow;
+	-o-transition-duration: 0.5s;
+	transition-property: background-color, box-shadow;
+	transition-duration: 0.5s;
+}
+
+div.line.glow {
+	background-color: cyan;
+	box-shadow: 0 0 10px cyan;
+}
+
+
+span.lineno {
+	padding-right: 4px;
+	text-align: right;
+	border-right: 2px solid #0F0;
+	background-color: #E8E8E8;
+        white-space: pre;
+}
+span.lineno a {
+	background-color: #D8D8D8;
+}
+
+span.lineno a:hover {
+	background-color: #C8C8C8;
+}
+
+div.ah, span.ah {
+	background-color: black;
+	font-weight: bold;
+	color: #ffffff;
+	margin-bottom: 3px;
+	margin-top: 3px;
+	padding: 0.2em;
+	border: solid thin #333;
+	border-radius: 0.5em;
+	-webkit-border-radius: .5em;
+	-moz-border-radius: .5em;
+	box-shadow: 2px 2px 3px #999;
+	-webkit-box-shadow: 2px 2px 3px #999;
+	-moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
+	background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444));
+	background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000);
+}
+
+div.classindex ul {
+        list-style: none;
+        padding-left: 0;
+}
+
+div.classindex span.ai {
+        display: inline-block;
+}
+
+div.groupHeader {
+	margin-left: 16px;
+	margin-top: 12px;
+	font-weight: bold;
+}
+
+div.groupText {
+	margin-left: 16px;
+	font-style: italic;
+}
+
+body {
+	background-color: white;
+	color: black;
+        margin: 0;
+}
+
+div.contents {
+	margin-top: 10px;
+	margin-left: 12px;
+	margin-right: 8px;
+}
+
+td.indexkey {
+	background-color: #EBEFF6;
+	font-weight: bold;
+	border: 1px solid #C4CFE5;
+	margin: 2px 0px 2px 0;
+	padding: 2px 10px;
+        white-space: nowrap;
+        vertical-align: top;
+}
+
+td.indexvalue {
+	background-color: #EBEFF6;
+	border: 1px solid #C4CFE5;
+	padding: 2px 10px;
+	margin: 2px 0px;
+}
+
+tr.memlist {
+	background-color: #EEF1F7;
+}
+
+p.formulaDsp {
+	text-align: center;
+}
+
+img.formulaDsp {
+	
+}
+
+img.formulaInl {
+	vertical-align: middle;
+}
+
+div.center {
+	text-align: center;
+        margin-top: 0px;
+        margin-bottom: 0px;
+        padding: 0px;
+}
+
+div.center img {
+	border: 0px;
+}
+
+address.footer {
+	text-align: right;
+	padding-right: 12px;
+}
+
+img.footer {
+	border: 0px;
+	vertical-align: middle;
+}
+
+/* @group Code Colorization */
+
+span.keyword {
+	color: #008000
+}
+
+span.keywordtype {
+	color: #604020
+}
+
+span.keywordflow {
+	color: #e08000
+}
+
+span.comment {
+	color: #800000
+}
+
+span.preprocessor {
+	color: #806020
+}
+
+span.stringliteral {
+	color: #002080
+}
+
+span.charliteral {
+	color: #008080
+}
+
+span.vhdldigit { 
+	color: #ff00ff 
+}
+
+span.vhdlchar { 
+	color: #000000 
+}
+
+span.vhdlkeyword { 
+	color: #700070 
+}
+
+span.vhdllogic { 
+	color: #ff0000 
+}
+
+blockquote {
+        background-color: #F7F8FB;
+        border-left: 2px solid #9CAFD4;
+        margin: 0 24px 0 4px;
+        padding: 0 12px 0 16px;
+}
+
+/* @end */
+
+/*
+.search {
+	color: #003399;
+	font-weight: bold;
+}
+
+form.search {
+	margin-bottom: 0px;
+	margin-top: 0px;
+}
+
+input.search {
+	font-size: 75%;
+	color: #000080;
+	font-weight: normal;
+	background-color: #e8eef2;
+}
+*/
+
+td.tiny {
+	font-size: 75%;
+}
+
+.dirtab {
+	padding: 4px;
+	border-collapse: collapse;
+	border: 1px solid #A3B4D7;
+}
+
+th.dirtab {
+	background: #EBEFF6;
+	font-weight: bold;
+}
+
+hr {
+	height: 0px;
+	border: none;
+	border-top: 1px solid #4A6AAA;
+}
+
+hr.footer {
+	height: 1px;
+}
+
+/* @group Member Descriptions */
+
+table.memberdecls {
+	border-spacing: 0px;
+	padding: 0px;
+}
+
+.memberdecls td, .fieldtable tr {
+	-webkit-transition-property: background-color, box-shadow;
+	-webkit-transition-duration: 0.5s;
+	-moz-transition-property: background-color, box-shadow;
+	-moz-transition-duration: 0.5s;
+	-ms-transition-property: background-color, box-shadow;
+	-ms-transition-duration: 0.5s;
+	-o-transition-property: background-color, box-shadow;
+	-o-transition-duration: 0.5s;
+	transition-property: background-color, box-shadow;
+	transition-duration: 0.5s;
+}
+
+.memberdecls td.glow, .fieldtable tr.glow {
+	background-color: cyan;
+	box-shadow: 0 0 15px cyan;
+}
+
+.mdescLeft, .mdescRight,
+.memItemLeft, .memItemRight,
+.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
+	background-color: #F9FAFC;
+	border: none;
+	margin: 4px;
+	padding: 1px 0 0 8px;
+}
+
+.mdescLeft, .mdescRight {
+	padding: 0px 8px 4px 8px;
+	color: #555;
+}
+
+.memSeparator {
+        border-bottom: 1px solid #DEE4F0;
+        line-height: 1px;
+        margin: 0px;
+        padding: 0px;
+}
+
+.memItemLeft, .memTemplItemLeft {
+        white-space: nowrap;
+}
+
+.memItemRight {
+	width: 100%;
+}
+
+.memTemplParams {
+	color: #4665A2;
+        white-space: nowrap;
+	font-size: 80%;
+}
+
+/* @end */
+
+/* @group Member Details */
+
+/* Styles for detailed member documentation */
+
+.memtemplate {
+	font-size: 80%;
+	color: #4665A2;
+	font-weight: normal;
+	margin-left: 9px;
+}
+
+.memnav {
+	background-color: #EBEFF6;
+	border: 1px solid #A3B4D7;
+	text-align: center;
+	margin: 2px;
+	margin-right: 15px;
+	padding: 2px;
+}
+
+.mempage {
+	width: 100%;
+}
+
+.memitem {
+	padding: 0;
+	margin-bottom: 10px;
+	margin-right: 5px;
+        -webkit-transition: box-shadow 0.5s linear;
+        -moz-transition: box-shadow 0.5s linear;
+        -ms-transition: box-shadow 0.5s linear;
+        -o-transition: box-shadow 0.5s linear;
+        transition: box-shadow 0.5s linear;
+        display: table !important;
+        width: 100%;
+}
+
+.memitem.glow {
+         box-shadow: 0 0 15px cyan;
+}
+
+.memname {
+        font-weight: bold;
+        margin-left: 6px;
+}
+
+.memname td {
+	vertical-align: bottom;
+}
+
+.memproto, dl.reflist dt {
+        border-top: 1px solid #A8B8D9;
+        border-left: 1px solid #A8B8D9;
+        border-right: 1px solid #A8B8D9;
+        padding: 6px 0px 6px 0px;
+        color: #253555;
+        font-weight: bold;
+        text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
+        background-image:url('nav_f.png');
+        background-repeat:repeat-x;
+        background-color: #E2E8F2;
+        /* opera specific markup */
+        box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+        border-top-right-radius: 4px;
+        border-top-left-radius: 4px;
+        /* firefox specific markup */
+        -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+        -moz-border-radius-topright: 4px;
+        -moz-border-radius-topleft: 4px;
+        /* webkit specific markup */
+        -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+        -webkit-border-top-right-radius: 4px;
+        -webkit-border-top-left-radius: 4px;
+
+}
+
+.memdoc, dl.reflist dd {
+        border-bottom: 1px solid #A8B8D9;      
+        border-left: 1px solid #A8B8D9;      
+        border-right: 1px solid #A8B8D9; 
+        padding: 6px 10px 2px 10px;
+        background-color: #FBFCFD;
+        border-top-width: 0;
+        background-image:url('nav_g.png');
+        background-repeat:repeat-x;
+        background-color: #FFFFFF;
+        /* opera specific markup */
+        border-bottom-left-radius: 4px;
+        border-bottom-right-radius: 4px;
+        box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+        /* firefox specific markup */
+        -moz-border-radius-bottomleft: 4px;
+        -moz-border-radius-bottomright: 4px;
+        -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+        /* webkit specific markup */
+        -webkit-border-bottom-left-radius: 4px;
+        -webkit-border-bottom-right-radius: 4px;
+        -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+}
+
+dl.reflist dt {
+        padding: 5px;
+}
+
+dl.reflist dd {
+        margin: 0px 0px 10px 0px;
+        padding: 5px;
+}
+
+.paramkey {
+	text-align: right;
+}
+
+.paramtype {
+	white-space: nowrap;
+}
+
+.paramname {
+	color: #602020;
+	white-space: nowrap;
+}
+.paramname em {
+	font-style: normal;
+}
+.paramname code {
+        line-height: 14px;
+}
+
+.params, .retval, .exception, .tparams {
+        margin-left: 0px;
+        padding-left: 0px;
+}       
+
+.params .paramname, .retval .paramname {
+        font-weight: bold;
+        vertical-align: top;
+}
+        
+.params .paramtype {
+        font-style: italic;
+        vertical-align: top;
+}       
+        
+.params .paramdir {
+        font-family: "courier new",courier,monospace;
+        vertical-align: top;
+}
+
+table.mlabels {
+	border-spacing: 0px;
+}
+
+td.mlabels-left {
+	width: 100%;
+	padding: 0px;
+}
+
+td.mlabels-right {
+	vertical-align: bottom;
+	padding: 0px;
+	white-space: nowrap;
+}
+
+span.mlabels {
+        margin-left: 8px;
+}
+
+span.mlabel {
+        background-color: #728DC1;
+        border-top:1px solid #5373B4;
+        border-left:1px solid #5373B4;
+        border-right:1px solid #C4CFE5;
+        border-bottom:1px solid #C4CFE5;
+	text-shadow: none;
+	color: white;
+	margin-right: 4px;
+	padding: 2px 3px;
+	border-radius: 3px;
+	font-size: 7pt;
+	white-space: nowrap;
+	vertical-align: middle;
+}
+
+
+
+/* @end */
+
+/* these are for tree view inside a (index) page */
+
+div.directory {
+        margin: 10px 0px;
+        border-top: 1px solid #9CAFD4;
+        border-bottom: 1px solid #9CAFD4;
+        width: 100%;
+}
+
+.directory table {
+        border-collapse:collapse;
+}
+
+.directory td {
+        margin: 0px;
+        padding: 0px;
+	vertical-align: top;
+}
+
+.directory td.entry {
+        white-space: nowrap;
+        padding-right: 6px;
+	padding-top: 3px;
+}
+
+.directory td.entry a {
+        outline:none;
+}
+
+.directory td.entry a img {
+        border: none;
+}
+
+.directory td.desc {
+        width: 100%;
+        padding-left: 6px;
+	padding-right: 6px;
+	padding-top: 3px;
+	border-left: 1px solid rgba(0,0,0,0.05);
+}
+
+.directory tr.even {
+	padding-left: 6px;
+	background-color: #F7F8FB;
+}
+
+.directory img {
+	vertical-align: -30%;
+}
+
+.directory .levels {
+        white-space: nowrap;
+        width: 100%;
+        text-align: right;
+        font-size: 9pt;
+}
+
+.directory .levels span {
+        cursor: pointer;
+        padding-left: 2px;
+        padding-right: 2px;
+	color: #3D578C;
+}
+
+.arrow {
+    color: #9CAFD4;
+    -webkit-user-select: none;
+    -khtml-user-select: none;
+    -moz-user-select: none;
+    -ms-user-select: none;
+    user-select: none;
+    cursor: pointer;
+    font-size: 80%;
+    display: inline-block;
+    width: 16px;
+    height: 22px;
+}
+
+.icon {
+    font-family: Arial, Helvetica;
+    font-weight: bold;
+    font-size: 12px;
+    height: 14px;
+    width: 16px;
+    display: inline-block;
+    background-color: #728DC1;
+    color: white;
+    text-align: center;
+    border-radius: 4px;
+    margin-left: 2px;
+    margin-right: 2px;
+}
+
+.icona {
+    width: 24px;
+    height: 22px;
+    display: inline-block;
+}
+
+.iconfopen {
+    width: 24px;
+    height: 18px;
+    margin-bottom: 4px;
+    background-image:url('folderopen.png');
+    background-position: 0px -4px;
+    background-repeat: repeat-y;
+    vertical-align:top;
+    display: inline-block;
+}
+
+.iconfclosed {
+    width: 24px;
+    height: 18px;
+    margin-bottom: 4px;
+    background-image:url('folderclosed.png');
+    background-position: 0px -4px;
+    background-repeat: repeat-y;
+    vertical-align:top;
+    display: inline-block;
+}
+
+.icondoc {
+    width: 24px;
+    height: 18px;
+    margin-bottom: 4px;
+    background-image:url('doc.png');
+    background-position: 0px -4px;
+    background-repeat: repeat-y;
+    vertical-align:top;
+    display: inline-block;
+}
+
+table.directory {
+    font: 400 14px Roboto,sans-serif;
+}
+
+/* @end */
+
+div.dynheader {
+        margin-top: 8px;
+	-webkit-touch-callout: none;
+	-webkit-user-select: none;
+	-khtml-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+address {
+	font-style: normal;
+	color: #2A3D61;
+}
+
+table.doxtable {
+	border-collapse:collapse;
+        margin-top: 4px;
+        margin-bottom: 4px;
+}
+
+table.doxtable td, table.doxtable th {
+	border: 1px solid #2D4068;
+	padding: 3px 7px 2px;
+}
+
+table.doxtable th {
+	background-color: #374F7F;
+	color: #FFFFFF;
+	font-size: 110%;
+	padding-bottom: 4px;
+	padding-top: 5px;
+}
+
+table.fieldtable {
+        /*width: 100%;*/
+        margin-bottom: 10px;
+        border: 1px solid #A8B8D9;
+        border-spacing: 0px;
+        -moz-border-radius: 4px;
+        -webkit-border-radius: 4px;
+        border-radius: 4px;
+        -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
+        -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15);
+        box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15);
+}
+
+.fieldtable td, .fieldtable th {
+        padding: 3px 7px 2px;
+}
+
+.fieldtable td.fieldtype, .fieldtable td.fieldname {
+        white-space: nowrap;
+        border-right: 1px solid #A8B8D9;
+        border-bottom: 1px solid #A8B8D9;
+        vertical-align: top;
+}
+
+.fieldtable td.fieldname {
+        padding-top: 3px;
+}
+
+.fieldtable td.fielddoc {
+        border-bottom: 1px solid #A8B8D9;
+        /*width: 100%;*/
+}
+
+.fieldtable td.fielddoc p:first-child {
+        margin-top: 0px;
+}       
+        
+.fieldtable td.fielddoc p:last-child {
+        margin-bottom: 2px;
+}
+
+.fieldtable tr:last-child td {
+        border-bottom: none;
+}
+
+.fieldtable th {
+        background-image:url('nav_f.png');
+        background-repeat:repeat-x;
+        background-color: #E2E8F2;
+        font-size: 90%;
+        color: #253555;
+        padding-bottom: 4px;
+        padding-top: 5px;
+        text-align:left;
+        -moz-border-radius-topleft: 4px;
+        -moz-border-radius-topright: 4px;
+        -webkit-border-top-left-radius: 4px;
+        -webkit-border-top-right-radius: 4px;
+        border-top-left-radius: 4px;
+        border-top-right-radius: 4px;
+        border-bottom: 1px solid #A8B8D9;
+}
+
+
+.tabsearch {
+	top: 0px;
+	left: 10px;
+	height: 36px;
+	background-image: url('tab_b.png');
+	z-index: 101;
+	overflow: hidden;
+	font-size: 13px;
+}
+
+.navpath ul
+{
+	font-size: 11px;
+	background-image:url('tab_b.png');
+	background-repeat:repeat-x;
+	background-position: 0 -5px;
+	height:30px;
+	line-height:30px;
+	color:#8AA0CC;
+	border:solid 1px #C2CDE4;
+	overflow:hidden;
+	margin:0px;
+	padding:0px;
+}
+
+.navpath li
+{
+	list-style-type:none;
+	float:left;
+	padding-left:10px;
+	padding-right:15px;
+	background-image:url('bc_s.png');
+	background-repeat:no-repeat;
+	background-position:right;
+	color:#364D7C;
+}
+
+.navpath li.navelem a
+{
+	height:32px;
+	display:block;
+	text-decoration: none;
+	outline: none;
+	color: #283A5D;
+	font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif;
+	text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
+	text-decoration: none;        
+}
+
+.navpath li.navelem a:hover
+{
+	color:#6884BD;
+}
+
+.navpath li.footer
+{
+        list-style-type:none;
+        float:right;
+        padding-left:10px;
+        padding-right:15px;
+        background-image:none;
+        background-repeat:no-repeat;
+        background-position:right;
+        color:#364D7C;
+        font-size: 8pt;
+}
+
+
+div.summary
+{
+	float: right;
+	font-size: 8pt;
+	padding-right: 5px;
+	width: 50%;
+	text-align: right;
+}       
+
+div.summary a
+{
+	white-space: nowrap;
+}
+
+div.ingroups
+{
+	font-size: 8pt;
+	width: 50%;
+	text-align: left;
+}
+
+div.ingroups a
+{
+	white-space: nowrap;
+}
+
+div.header
+{
+        background-image:url('nav_h.png');
+        background-repeat:repeat-x;
+	background-color: #F9FAFC;
+	margin:  0px;
+	border-bottom: 1px solid #C4CFE5;
+}
+
+div.headertitle
+{
+	padding: 5px 5px 5px 10px;
+}
+
+dl
+{
+        padding: 0 0 0 10px;
+}
+
+/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */
+dl.section
+{
+	margin-left: 0px;
+	padding-left: 0px;
+}
+
+dl.note
+{
+        margin-left:-7px;
+        padding-left: 3px;
+        border-left:4px solid;
+        border-color: #D0C000;
+}
+
+dl.warning, dl.attention
+{
+        margin-left:-7px;
+        padding-left: 3px;
+        border-left:4px solid;
+        border-color: #FF0000;
+}
+
+dl.pre, dl.post, dl.invariant
+{
+        margin-left:-7px;
+        padding-left: 3px;
+        border-left:4px solid;
+        border-color: #00D000;
+}
+
+dl.deprecated
+{
+        margin-left:-7px;
+        padding-left: 3px;
+        border-left:4px solid;
+        border-color: #505050;
+}
+
+dl.todo
+{
+        margin-left:-7px;
+        padding-left: 3px;
+        border-left:4px solid;
+        border-color: #00C0E0;
+}
+
+dl.test
+{
+        margin-left:-7px;
+        padding-left: 3px;
+        border-left:4px solid;
+        border-color: #3030E0;
+}
+
+dl.bug
+{
+        margin-left:-7px;
+        padding-left: 3px;
+        border-left:4px solid;
+        border-color: #C08050;
+}
+
+dl.section dd {
+	margin-bottom: 6px;
+}
+
+
+#projectlogo
+{
+	text-align: center;
+	vertical-align: bottom;
+	border-collapse: separate;
+}
+ 
+#projectlogo img
+{ 
+	border: 0px none;
+}
+ 
+#projectname
+{
+	font: 300% Tahoma, Arial,sans-serif;
+	margin: 0px;
+	padding: 2px 0px;
+}
+    
+#projectbrief
+{
+	font: 120% Tahoma, Arial,sans-serif;
+	margin: 0px;
+	padding: 0px;
+}
+
+#projectnumber
+{
+	font: 50% Tahoma, Arial,sans-serif;
+	margin: 0px;
+	padding: 0px;
+}
+
+#titlearea
+{
+	padding: 0px;
+	margin: 0px;
+	width: 100%;
+	border-bottom: 1px solid #5373B4;
+}
+
+.image
+{
+        text-align: center;
+}
+
+.dotgraph
+{
+        text-align: center;
+}
+
+.mscgraph
+{
+        text-align: center;
+}
+
+.diagraph
+{
+        text-align: center;
+}
+
+.caption
+{
+	font-weight: bold;
+}
+
+div.zoom
+{
+	border: 1px solid #90A5CE;
+}
+
+dl.citelist {
+        margin-bottom:50px;
+}
+
+dl.citelist dt {
+        color:#334975;
+        float:left;
+        font-weight:bold;
+        margin-right:10px;
+        padding:5px;
+}
+
+dl.citelist dd {
+        margin:2px 0;
+        padding:5px 0;
+}
+
+div.toc {
+        padding: 14px 25px;
+        background-color: #F4F6FA;
+        border: 1px solid #D8DFEE;
+        border-radius: 7px 7px 7px 7px;
+        float: right;
+        height: auto;
+        margin: 0 20px 10px 10px;
+        width: 200px;
+}
+
+div.toc li {
+        background: url("bdwn.png") no-repeat scroll 0 5px transparent;
+        font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif;
+        margin-top: 5px;
+        padding-left: 10px;
+        padding-top: 2px;
+}
+
+div.toc h3 {
+        font: bold 12px/1.2 Arial,FreeSans,sans-serif;
+	color: #4665A2;
+        border-bottom: 0 none;
+        margin: 0;
+}
+
+div.toc ul {
+        list-style: none outside none;
+        border: medium none;
+        padding: 0px;
+}       
+
+div.toc li.level1 {
+        margin-left: 0px;
+}
+
+div.toc li.level2 {
+        margin-left: 15px;
+}
+
+div.toc li.level3 {
+        margin-left: 30px;
+}
+
+div.toc li.level4 {
+        margin-left: 45px;
+}
+
+.inherit_header {
+        font-weight: bold;
+        color: gray;
+        cursor: pointer;
+	-webkit-touch-callout: none;
+	-webkit-user-select: none;
+	-khtml-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+.inherit_header td {
+        padding: 6px 0px 2px 5px;
+}
+
+.inherit {
+        display: none;
+}
+
+tr.heading h2 {
+        margin-top: 12px;
+        margin-bottom: 4px;
+}
+
+/* tooltip related style info */
+
+.ttc {
+        position: absolute;
+        display: none;
+}
+
+#powerTip {
+	cursor: default;
+	white-space: nowrap;
+	background-color: white;
+	border: 1px solid gray;
+	border-radius: 4px 4px 4px 4px;
+	box-shadow: 1px 1px 7px gray;
+	display: none;
+	font-size: smaller;
+	max-width: 80%;
+	opacity: 0.9;
+	padding: 1ex 1em 1em;
+	position: absolute;
+	z-index: 2147483647;
+}
+
+#powerTip div.ttdoc {
+        color: grey;
+	font-style: italic;
+}
+
+#powerTip div.ttname a {
+        font-weight: bold;
+}
+
+#powerTip div.ttname {
+        font-weight: bold;
+}
+
+#powerTip div.ttdeci {
+        color: #006318;
+}
+
+#powerTip div {
+        margin: 0px;
+        padding: 0px;
+        font: 12px/16px Roboto,sans-serif;
+}
+
+#powerTip:before, #powerTip:after {
+	content: "";
+	position: absolute;
+	margin: 0px;
+}
+
+#powerTip.n:after,  #powerTip.n:before,
+#powerTip.s:after,  #powerTip.s:before,
+#powerTip.w:after,  #powerTip.w:before,
+#powerTip.e:after,  #powerTip.e:before,
+#powerTip.ne:after, #powerTip.ne:before,
+#powerTip.se:after, #powerTip.se:before,
+#powerTip.nw:after, #powerTip.nw:before,
+#powerTip.sw:after, #powerTip.sw:before {
+	border: solid transparent;
+	content: " ";
+	height: 0;
+	width: 0;
+	position: absolute;
+}
+
+#powerTip.n:after,  #powerTip.s:after,
+#powerTip.w:after,  #powerTip.e:after,
+#powerTip.nw:after, #powerTip.ne:after,
+#powerTip.sw:after, #powerTip.se:after {
+	border-color: rgba(255, 255, 255, 0);
+}
+
+#powerTip.n:before,  #powerTip.s:before,
+#powerTip.w:before,  #powerTip.e:before,
+#powerTip.nw:before, #powerTip.ne:before,
+#powerTip.sw:before, #powerTip.se:before {
+	border-color: rgba(128, 128, 128, 0);
+}
+
+#powerTip.n:after,  #powerTip.n:before,
+#powerTip.ne:after, #powerTip.ne:before,
+#powerTip.nw:after, #powerTip.nw:before {
+	top: 100%;
+}
+
+#powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after {
+	border-top-color: #ffffff;
+	border-width: 10px;
+	margin: 0px -10px;
+}
+#powerTip.n:before {
+	border-top-color: #808080;
+	border-width: 11px;
+	margin: 0px -11px;
+}
+#powerTip.n:after, #powerTip.n:before {
+	left: 50%;
+}
+
+#powerTip.nw:after, #powerTip.nw:before {
+	right: 14px;
+}
+
+#powerTip.ne:after, #powerTip.ne:before {
+	left: 14px;
+}
+
+#powerTip.s:after,  #powerTip.s:before,
+#powerTip.se:after, #powerTip.se:before,
+#powerTip.sw:after, #powerTip.sw:before {
+	bottom: 100%;
+}
+
+#powerTip.s:after, #powerTip.se:after, #powerTip.sw:after {
+	border-bottom-color: #ffffff;
+	border-width: 10px;
+	margin: 0px -10px;
+}
+
+#powerTip.s:before, #powerTip.se:before, #powerTip.sw:before {
+	border-bottom-color: #808080;
+	border-width: 11px;
+	margin: 0px -11px;
+}
+
+#powerTip.s:after, #powerTip.s:before {
+	left: 50%;
+}
+
+#powerTip.sw:after, #powerTip.sw:before {
+	right: 14px;
+}
+
+#powerTip.se:after, #powerTip.se:before {
+	left: 14px;
+}
+
+#powerTip.e:after, #powerTip.e:before {
+	left: 100%;
+}
+#powerTip.e:after {
+	border-left-color: #ffffff;
+	border-width: 10px;
+	top: 50%;
+	margin-top: -10px;
+}
+#powerTip.e:before {
+	border-left-color: #808080;
+	border-width: 11px;
+	top: 50%;
+	margin-top: -11px;
+}
+
+#powerTip.w:after, #powerTip.w:before {
+	right: 100%;
+}
+#powerTip.w:after {
+	border-right-color: #ffffff;
+	border-width: 10px;
+	top: 50%;
+	margin-top: -10px;
+}
+#powerTip.w:before {
+	border-right-color: #808080;
+	border-width: 11px;
+	top: 50%;
+	margin-top: -11px;
+}
+
+@media print
+{
+  #top { display: none; }
+  #side-nav { display: none; }
+  #nav-path { display: none; }
+  body { overflow:visible; }
+  h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
+  .summary { display: none; }
+  .memitem { page-break-inside: avoid; }
+  #doc-content
+  {
+    margin-left:0 !important;
+    height:auto !important;
+    width:auto !important;
+    overflow:inherit;
+    display:inline;
+  }
+}
+
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/dynsections.js
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/dynsections.js	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/dynsections.js	(revision 189)
@@ -0,0 +1,97 @@
+function toggleVisibility(linkObj)
+{
+ var base = $(linkObj).attr('id');
+ var summary = $('#'+base+'-summary');
+ var content = $('#'+base+'-content');
+ var trigger = $('#'+base+'-trigger');
+ var src=$(trigger).attr('src');
+ if (content.is(':visible')===true) {
+   content.hide();
+   summary.show();
+   $(linkObj).addClass('closed').removeClass('opened');
+   $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
+ } else {
+   content.show();
+   summary.hide();
+   $(linkObj).removeClass('closed').addClass('opened');
+   $(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
+ } 
+ return false;
+}
+
+function updateStripes()
+{
+  $('table.directory tr').
+       removeClass('even').filter(':visible:even').addClass('even');
+}
+
+function toggleLevel(level)
+{
+  $('table.directory tr').each(function() {
+    var l = this.id.split('_').length-1;
+    var i = $('#img'+this.id.substring(3));
+    var a = $('#arr'+this.id.substring(3));
+    if (l<level+1) {
+      i.removeClass('iconfopen iconfclosed').addClass('iconfopen');
+      a.html('&#9660;');
+      $(this).show();
+    } else if (l==level+1) {
+      i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');
+      a.html('&#9658;');
+      $(this).show();
+    } else {
+      $(this).hide();
+    }
+  });
+  updateStripes();
+}
+
+function toggleFolder(id)
+{
+  // the clicked row
+  var currentRow = $('#row_'+id);
+
+  // all rows after the clicked row
+  var rows = currentRow.nextAll("tr");
+
+  var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub
+
+  // only match elements AFTER this one (can't hide elements before)
+  var childRows = rows.filter(function() { return this.id.match(re); });
+
+  // first row is visible we are HIDING
+  if (childRows.filter(':first').is(':visible')===true) {
+    // replace down arrow by right arrow for current row
+    var currentRowSpans = currentRow.find("span");
+    currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
+    currentRowSpans.filter(".arrow").html('&#9658;');
+    rows.filter("[id^=row_"+id+"]").hide(); // hide all children
+  } else { // we are SHOWING
+    // replace right arrow by down arrow for current row
+    var currentRowSpans = currentRow.find("span");
+    currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");
+    currentRowSpans.filter(".arrow").html('&#9660;');
+    // replace down arrows by right arrows for child rows
+    var childRowsSpans = childRows.find("span");
+    childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
+    childRowsSpans.filter(".arrow").html('&#9658;');
+    childRows.show(); //show all children
+  }
+  updateStripes();
+}
+
+
+function toggleInherit(id)
+{
+  var rows = $('tr.inherit.'+id);
+  var img = $('tr.inherit_header.'+id+' img');
+  var src = $(img).attr('src');
+  if (rows.filter(':first').is(':visible')===true) {
+    rows.css('display','none');
+    $(img).attr('src',src.substring(0,src.length-8)+'closed.png');
+  } else {
+    rows.css('display','table-row'); // using show() causes jump in firefox
+    $(img).attr('src',src.substring(0,src.length-10)+'open.png');
+  }
+}
+
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/functions.html
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/functions.html	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/functions.html	(revision 189)
@@ -0,0 +1,118 @@
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.9.1"/>
+<title>ThingSpeak Communication Library For Arduino, ESP8266, and Particle</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr style="height: 56px;">
+  <td style="padding-left: 0.5em;">
+   <div id="projectname">ThingSpeak Communication Library</div>
+   <div id="projectbrief">Enables an Arduino, ESP8266, or Particle to write or read data to or from ThingSpeak&trade;</div>
+  </td>
+  <td valign="middle" align="right" id="projectlogo"><img alt="Logo" src="ThingSpeakLogo.jpg"/></td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.9.1 -->
+  <div id="navrow1" class="tabs">
+    <ul class="tablist">
+      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
+      <li class="current"><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
+    </ul>
+  </div>
+  <div id="navrow2" class="tabs2">
+    <ul class="tablist">
+      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
+      <li class="current"><a href="functions.html"><span>Data&#160;Fields</span></a></li>
+    </ul>
+  </div>
+  <div id="navrow3" class="tabs2">
+    <ul class="tablist">
+      <li class="current"><a href="functions.html"><span>All</span></a></li>
+      <li><a href="functions_func.html"><span>Functions</span></a></li>
+    </ul>
+  </div>
+</div><!-- top -->
+<div class="contents">
+<div class="textblock">Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:</div><ul>
+<li>begin()
+: <a class="el" href="class_thing_speak_class.html#a7375bc37b4cbf132751439f5fcafd1ba">ThingSpeakClass</a>
+</li>
+<li>getLastReadStatus()
+: <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577">ThingSpeakClass</a>
+</li>
+<li>readFloatField()
+: <a class="el" href="class_thing_speak_class.html#a02cd79a65f1229711801fac5aec158b4">ThingSpeakClass</a>
+</li>
+<li>readIntField()
+: <a class="el" href="class_thing_speak_class.html#adb2ba704f38e591a6a391f7aa1850818">ThingSpeakClass</a>
+</li>
+<li>readLongField()
+: <a class="el" href="class_thing_speak_class.html#aff3c2e94e85da016fb8c82432e015d1b">ThingSpeakClass</a>
+</li>
+<li>readRaw()
+: <a class="el" href="class_thing_speak_class.html#a578758c62a821dc9197ec6a3fdc0f7bc">ThingSpeakClass</a>
+</li>
+<li>readStringField()
+: <a class="el" href="class_thing_speak_class.html#a7ed5914c2f5c7d84672cdaae3547da96">ThingSpeakClass</a>
+</li>
+<li>setElevation()
+: <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9">ThingSpeakClass</a>
+</li>
+<li>setField()
+: <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">ThingSpeakClass</a>
+</li>
+<li>setLatitude()
+: <a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400">ThingSpeakClass</a>
+</li>
+<li>setLongitude()
+: <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e">ThingSpeakClass</a>
+</li>
+<li>writeField()
+: <a class="el" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">ThingSpeakClass</a>
+</li>
+<li>writeFields()
+: <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">ThingSpeakClass</a>
+</li>
+<li>writeRaw()
+: <a class="el" href="class_thing_speak_class.html#a2a5333f683802cb455a3713d604abb84">ThingSpeakClass</a>
+</li>
+</ul>
+</div><!-- contents -->
+<!-- HTML footer for doxygen 1.8.9.1-->
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!-- start footer part -->
+<hr class="footer"/><address class="footer"><small>
+     <table border=0 width='100%'><tr>
+        <td align="left" width='50%'>
+          See the accompaning licence file for licensing information
+        </td>
+        <td align="right" width='50%'>
+          Copyright &copy; 2016 <a target=_top href=http://www.mathworks.com>The MathWorks, Inc.</a><br>
+        </td>
+      </tr></table>
+</small></address>
+</body>
+</html>
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/functions_func.html
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/functions_func.html	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/functions_func.html	(revision 189)
@@ -0,0 +1,118 @@
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.9.1"/>
+<title>ThingSpeak Communication Library For Arduino, ESP8266, and Particle</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr style="height: 56px;">
+  <td style="padding-left: 0.5em;">
+   <div id="projectname">ThingSpeak Communication Library</div>
+   <div id="projectbrief">Enables an Arduino, ESP8266, or Particle to write or read data to or from ThingSpeak&trade;</div>
+  </td>
+  <td valign="middle" align="right" id="projectlogo"><img alt="Logo" src="ThingSpeakLogo.jpg"/></td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.9.1 -->
+  <div id="navrow1" class="tabs">
+    <ul class="tablist">
+      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
+      <li class="current"><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
+    </ul>
+  </div>
+  <div id="navrow2" class="tabs2">
+    <ul class="tablist">
+      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
+      <li class="current"><a href="functions.html"><span>Data&#160;Fields</span></a></li>
+    </ul>
+  </div>
+  <div id="navrow3" class="tabs2">
+    <ul class="tablist">
+      <li><a href="functions.html"><span>All</span></a></li>
+      <li class="current"><a href="functions_func.html"><span>Functions</span></a></li>
+    </ul>
+  </div>
+</div><!-- top -->
+<div class="contents">
+&#160;<ul>
+<li>begin()
+: <a class="el" href="class_thing_speak_class.html#a7375bc37b4cbf132751439f5fcafd1ba">ThingSpeakClass</a>
+</li>
+<li>getLastReadStatus()
+: <a class="el" href="class_thing_speak_class.html#a549941b4b0000a2ba89de94f038ed577">ThingSpeakClass</a>
+</li>
+<li>readFloatField()
+: <a class="el" href="class_thing_speak_class.html#a02cd79a65f1229711801fac5aec158b4">ThingSpeakClass</a>
+</li>
+<li>readIntField()
+: <a class="el" href="class_thing_speak_class.html#adb2ba704f38e591a6a391f7aa1850818">ThingSpeakClass</a>
+</li>
+<li>readLongField()
+: <a class="el" href="class_thing_speak_class.html#aff3c2e94e85da016fb8c82432e015d1b">ThingSpeakClass</a>
+</li>
+<li>readRaw()
+: <a class="el" href="class_thing_speak_class.html#a578758c62a821dc9197ec6a3fdc0f7bc">ThingSpeakClass</a>
+</li>
+<li>readStringField()
+: <a class="el" href="class_thing_speak_class.html#a7ed5914c2f5c7d84672cdaae3547da96">ThingSpeakClass</a>
+</li>
+<li>setElevation()
+: <a class="el" href="class_thing_speak_class.html#a1e9cc3c21e0a7360310aba628ef586c9">ThingSpeakClass</a>
+</li>
+<li>setField()
+: <a class="el" href="class_thing_speak_class.html#a72eea45043ab45051c02593983d29546">ThingSpeakClass</a>
+</li>
+<li>setLatitude()
+: <a class="el" href="class_thing_speak_class.html#ad790afb71eb19b723c6fc2f17f8f4400">ThingSpeakClass</a>
+</li>
+<li>setLongitude()
+: <a class="el" href="class_thing_speak_class.html#a8cb07c25c717a5acc5d8de60b19c0c3e">ThingSpeakClass</a>
+</li>
+<li>writeField()
+: <a class="el" href="class_thing_speak_class.html#a24fa89e20ef8b3314ad8270c1f81dd2d">ThingSpeakClass</a>
+</li>
+<li>writeFields()
+: <a class="el" href="class_thing_speak_class.html#a986d1958d5aa6705a53a31f3975f8cae">ThingSpeakClass</a>
+</li>
+<li>writeRaw()
+: <a class="el" href="class_thing_speak_class.html#a2a5333f683802cb455a3713d604abb84">ThingSpeakClass</a>
+</li>
+</ul>
+</div><!-- contents -->
+<!-- HTML footer for doxygen 1.8.9.1-->
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!-- start footer part -->
+<hr class="footer"/><address class="footer"><small>
+     <table border=0 width='100%'><tr>
+        <td align="left" width='50%'>
+          See the accompaning licence file for licensing information
+        </td>
+        <td align="right" width='50%'>
+          Copyright &copy; 2016 <a target=_top href=http://www.mathworks.com>The MathWorks, Inc.</a><br>
+        </td>
+      </tr></table>
+</small></address>
+</body>
+</html>
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/index.html
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/index.html	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/index.html	(revision 189)
@@ -0,0 +1,87 @@
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.9.1"/>
+<title>ThingSpeak Communication Library For Arduino, ESP8266, and Particle</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr style="height: 56px;">
+  <td style="padding-left: 0.5em;">
+   <div id="projectname">ThingSpeak Communication Library</div>
+   <div id="projectbrief">Enables an Arduino, ESP8266, or Particle to write or read data to or from ThingSpeak&trade;</div>
+  </td>
+  <td valign="middle" align="right" id="projectlogo"><img alt="Logo" src="ThingSpeakLogo.jpg"/></td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.9.1 -->
+  <div id="navrow1" class="tabs">
+    <ul class="tablist">
+      <li class="current"><a href="index.html"><span>Main&#160;Page</span></a></li>
+      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
+    </ul>
+  </div>
+</div><!-- top -->
+<div class="header">
+  <div class="headertitle">
+<div class="title">ThingSpeak Communication Library Documentation</div>  </div>
+</div><!--header-->
+<div class="contents">
+<div class="textblock"><p><a class="el" href="class_thing_speak_class.html">For technical documentation, visit this page</a></p>
+<p>ThingSpeak offers free data storage and analysis of time-stamped numeric or alphanumeric data. Users can access ThingSpeak by visiting <a href="http://thingspeak.com">http://thingspeak.com</a> and creating a ThingSpeak user account.</p>
+<p>ThingSpeak stores data in channels. Channels support an unlimited number of timestamped observations (think of these as rows in a spreadsheet). Each channel has up to 8 fields (think of these as columns in a speadsheet). Check out this <a href="http://www.mathworks.com/videos/introduction-to-thingspeak-107749.html">video</a> for an overview.</p>
+<p>Channels may be public, where anyone can see the data, or private, where only the owner and select users can read the data. Each channel has an associated Write API Key that is used to control who can write to a channel. In addition, private channels have one or more Read API Keys to control who can read from private channel. An API Key is not required to read from public channels. Each channel can have up to 8 fields. One field is created by default.</p>
+<p>You can visualize and do online analytics of your data on ThingSpeak using the built in version of MATLAB, or use the desktop version of MATLAB to get deeper historical insight. Visit <a href="https://www.mathworks.com/hardware-support/thingspeak.html">https://www.mathworks.com/hardware-support/thingspeak.html</a> to learn more.</p>
+<h3>Compatible Hardware</h3>
+<ul>
+<li><a href="http://www.arduino.cc">Arduino</a> or compatible using a wired or Wi-Fi ethernet shield (we have tested with <a href="http://www.arduino.cc/en/Main/ArduinoBoardUno">Uno</a> and <a href="http://www.arduino.cc/en/Main/ArduinoBoardMega2560">Mega</a>), should work with Arduino WiFi Shield 101</li>
+<li><a href="http://www.arduino.cc/en/Main/ArduinoBoardYun">Arduino Yun</a> running OpenWRT-Yun Release 1.5.3 (November 13th, 2014) or later. There are known issues with earlier versions. Visit <a href="http://www.arduino.cc/en/Main/Software">this page</a> to get the latest version.</li>
+<li>ESP8266 (tested with <a href="https://www.sparkfun.com/products/13711">SparkFun ESP8266 Thing - Dev Board</a> and <a href="http://www.seeedstudio.com/depot/NodeMCU-v2-Lua-based-ESP8266-development-kit-p-2415.html">NodeMCU 1.0 module</a>)</li>
+<li>Particle (Formally Spark) Core, <a href="https://www.particle.io/prototype#photon">Photon</a>, and <a href="https://www.particle.io/prototype#electron">Electron</a></li>
+</ul>
+<h3>Examples</h3>
+<p>The library includes several examples to help you get started. These are accessible in the Examples/ThingSpeak menu off the File menu in the Arduino IDE.</p><ul>
+<li><b>CheerLights:</b> Reads the latest <a href="http://www.cheerlights.com">CheerLights</a> color on ThingSpeak, and sets an RGB LED.</li>
+<li><b>ReadLastTemperature:</b> Reads the latest temperature from the public <a href="https://thingspeak.com/channels/12397">MathWorks weather station</a> in Natick, MA on ThingSpeak.</li>
+<li><b>ReadPrivateChannel:</b> Reads the latest voltage value from a private channel on ThingSpeak.</li>
+<li><b>ReadWeatherStation:</b> Reads the latest weather data from the public <a href="https://thingspeak.com/channels/12397">MathWorks weather station</a> in Natick, MA on ThingSpeak.</li>
+<li><b>WriteMultipleVoltages:</b> Reads analog voltages from pins 0-7 and writes them to the 8 fields of a channel on ThingSpeak.</li>
+<li><b>WriteVoltage:</b> Reads an analog voltage from pin 0, converts to a voltage, and writes it to a channel on ThingSpeak. </li>
+</ul>
+</div></div><!-- contents -->
+<!-- HTML footer for doxygen 1.8.9.1-->
+<!--   ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  Copyright 2016, The MathWorks, Inc.
+  See the accompaning licence file for licensing information.-->
+<!-- start footer part -->
+<hr class="footer"/><address class="footer"><small>
+     <table border=0 width='100%'><tr>
+        <td align="left" width='50%'>
+          See the accompaning licence file for licensing information
+        </td>
+        <td align="right" width='50%'>
+          Copyright &copy; 2016 <a target=_top href=http://www.mathworks.com>The MathWorks, Inc.</a><br>
+        </td>
+      </tr></table>
+</small></address>
+</body>
+</html>
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/jquery.js
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/jquery.js	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/jquery.js	(revision 189)
@@ -0,0 +1,68 @@
+/*!
+ * jQuery JavaScript Library v1.7.1
+ * http://jquery.com/
+ *
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Mon Nov 21 21:11:03 2011 -0500
+ */
+(function(bb,L){var av=bb.document,bu=bb.navigator,bl=bb.location;var b=(function(){var bF=function(b0,b1){return new bF.fn.init(b0,b1,bD)},bU=bb.jQuery,bH=bb.$,bD,bY=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,bM=/\S/,bI=/^\s+/,bE=/\s+$/,bA=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bN=/^[\],:{}\s]*$/,bW=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,bP=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bJ=/(?:^|:|,)(?:\s*\[)+/g,by=/(webkit)[ \/]([\w.]+)/,bR=/(opera)(?:.*version)?[ \/]([\w.]+)/,bQ=/(msie) ([\w.]+)/,bS=/(mozilla)(?:.*? rv:([\w.]+))?/,bB=/-([a-z]|[0-9])/ig,bZ=/^-ms-/,bT=function(b0,b1){return(b1+"").toUpperCase()},bX=bu.userAgent,bV,bC,e,bL=Object.prototype.toString,bG=Object.prototype.hasOwnProperty,bz=Array.prototype.push,bK=Array.prototype.slice,bO=String.prototype.trim,bv=Array.prototype.indexOf,bx={};bF.fn=bF.prototype={constructor:bF,init:function(b0,b4,b3){var b2,b5,b1,b6;if(!b0){return this}if(b0.nodeType){this.context=this[0]=b0;this.length=1;return this}if(b0==="body"&&!b4&&av.body){this.context=av;this[0]=av.body;this.selector=b0;this.length=1;return this}if(typeof b0==="string"){if(b0.charAt(0)==="<"&&b0.charAt(b0.length-1)===">"&&b0.length>=3){b2=[null,b0,null]}else{b2=bY.exec(b0)}if(b2&&(b2[1]||!b4)){if(b2[1]){b4=b4 instanceof bF?b4[0]:b4;b6=(b4?b4.ownerDocument||b4:av);b1=bA.exec(b0);if(b1){if(bF.isPlainObject(b4)){b0=[av.createElement(b1[1])];bF.fn.attr.call(b0,b4,true)}else{b0=[b6.createElement(b1[1])]}}else{b1=bF.buildFragment([b2[1]],[b6]);b0=(b1.cacheable?bF.clone(b1.fragment):b1.fragment).childNodes}return bF.merge(this,b0)}else{b5=av.getElementById(b2[2]);if(b5&&b5.parentNode){if(b5.id!==b2[2]){return b3.find(b0)}this.length=1;this[0]=b5}this.context=av;this.selector=b0;return this}}else{if(!b4||b4.jquery){return(b4||b3).find(b0)}else{return this.constructor(b4).find(b0)}}}else{if(bF.isFunction(b0)){return b3.ready(b0)}}if(b0.selector!==L){this.selector=b0.selector;this.context=b0.context}return bF.makeArray(b0,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return bK.call(this,0)},get:function(b0){return b0==null?this.toArray():(b0<0?this[this.length+b0]:this[b0])},pushStack:function(b1,b3,b0){var b2=this.constructor();if(bF.isArray(b1)){bz.apply(b2,b1)}else{bF.merge(b2,b1)}b2.prevObject=this;b2.context=this.context;if(b3==="find"){b2.selector=this.selector+(this.selector?" ":"")+b0}else{if(b3){b2.selector=this.selector+"."+b3+"("+b0+")"}}return b2},each:function(b1,b0){return bF.each(this,b1,b0)},ready:function(b0){bF.bindReady();bC.add(b0);return this},eq:function(b0){b0=+b0;return b0===-1?this.slice(b0):this.slice(b0,b0+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bK.apply(this,arguments),"slice",bK.call(arguments).join(","))},map:function(b0){return this.pushStack(bF.map(this,function(b2,b1){return b0.call(b2,b1,b2)}))},end:function(){return this.prevObject||this.constructor(null)},push:bz,sort:[].sort,splice:[].splice};bF.fn.init.prototype=bF.fn;bF.extend=bF.fn.extend=function(){var b9,b2,b0,b1,b6,b7,b5=arguments[0]||{},b4=1,b3=arguments.length,b8=false;if(typeof b5==="boolean"){b8=b5;b5=arguments[1]||{};b4=2}if(typeof b5!=="object"&&!bF.isFunction(b5)){b5={}}if(b3===b4){b5=this;--b4}for(;b4<b3;b4++){if((b9=arguments[b4])!=null){for(b2 in b9){b0=b5[b2];b1=b9[b2];if(b5===b1){continue}if(b8&&b1&&(bF.isPlainObject(b1)||(b6=bF.isArray(b1)))){if(b6){b6=false;b7=b0&&bF.isArray(b0)?b0:[]}else{b7=b0&&bF.isPlainObject(b0)?b0:{}}b5[b2]=bF.extend(b8,b7,b1)}else{if(b1!==L){b5[b2]=b1}}}}}return b5};bF.extend({noConflict:function(b0){if(bb.$===bF){bb.$=bH}if(b0&&bb.jQuery===bF){bb.jQuery=bU}return bF},isReady:false,readyWait:1,holdReady:function(b0){if(b0){bF.readyWait++}else{bF.ready(true)}},ready:function(b0){if((b0===true&&!--bF.readyWait)||(b0!==true&&!bF.isReady)){if(!av.body){return setTimeout(bF.ready,1)}bF.isReady=true;if(b0!==true&&--bF.readyWait>0){return}bC.fireWith(av,[bF]);if(bF.fn.trigger){bF(av).trigger("ready").off("ready")}}},bindReady:function(){if(bC){return}bC=bF.Callbacks("once memory");if(av.readyState==="complete"){return setTimeout(bF.ready,1)}if(av.addEventListener){av.addEventListener("DOMContentLoaded",e,false);bb.addEventListener("load",bF.ready,false)}else{if(av.attachEvent){av.attachEvent("onreadystatechange",e);bb.attachEvent("onload",bF.ready);var b0=false;try{b0=bb.frameElement==null}catch(b1){}if(av.documentElement.doScroll&&b0){bw()}}}},isFunction:function(b0){return bF.type(b0)==="function"},isArray:Array.isArray||function(b0){return bF.type(b0)==="array"},isWindow:function(b0){return b0&&typeof b0==="object"&&"setInterval" in b0},isNumeric:function(b0){return !isNaN(parseFloat(b0))&&isFinite(b0)},type:function(b0){return b0==null?String(b0):bx[bL.call(b0)]||"object"},isPlainObject:function(b2){if(!b2||bF.type(b2)!=="object"||b2.nodeType||bF.isWindow(b2)){return false}try{if(b2.constructor&&!bG.call(b2,"constructor")&&!bG.call(b2.constructor.prototype,"isPrototypeOf")){return false}}catch(b1){return false}var b0;for(b0 in b2){}return b0===L||bG.call(b2,b0)},isEmptyObject:function(b1){for(var b0 in b1){return false}return true},error:function(b0){throw new Error(b0)},parseJSON:function(b0){if(typeof b0!=="string"||!b0){return null}b0=bF.trim(b0);if(bb.JSON&&bb.JSON.parse){return bb.JSON.parse(b0)}if(bN.test(b0.replace(bW,"@").replace(bP,"]").replace(bJ,""))){return(new Function("return "+b0))()}bF.error("Invalid JSON: "+b0)},parseXML:function(b2){var b0,b1;try{if(bb.DOMParser){b1=new DOMParser();b0=b1.parseFromString(b2,"text/xml")}else{b0=new ActiveXObject("Microsoft.XMLDOM");b0.async="false";b0.loadXML(b2)}}catch(b3){b0=L}if(!b0||!b0.documentElement||b0.getElementsByTagName("parsererror").length){bF.error("Invalid XML: "+b2)}return b0},noop:function(){},globalEval:function(b0){if(b0&&bM.test(b0)){(bb.execScript||function(b1){bb["eval"].call(bb,b1)})(b0)}},camelCase:function(b0){return b0.replace(bZ,"ms-").replace(bB,bT)},nodeName:function(b1,b0){return b1.nodeName&&b1.nodeName.toUpperCase()===b0.toUpperCase()},each:function(b3,b6,b2){var b1,b4=0,b5=b3.length,b0=b5===L||bF.isFunction(b3);if(b2){if(b0){for(b1 in b3){if(b6.apply(b3[b1],b2)===false){break}}}else{for(;b4<b5;){if(b6.apply(b3[b4++],b2)===false){break}}}}else{if(b0){for(b1 in b3){if(b6.call(b3[b1],b1,b3[b1])===false){break}}}else{for(;b4<b5;){if(b6.call(b3[b4],b4,b3[b4++])===false){break}}}}return b3},trim:bO?function(b0){return b0==null?"":bO.call(b0)}:function(b0){return b0==null?"":b0.toString().replace(bI,"").replace(bE,"")},makeArray:function(b3,b1){var b0=b1||[];if(b3!=null){var b2=bF.type(b3);if(b3.length==null||b2==="string"||b2==="function"||b2==="regexp"||bF.isWindow(b3)){bz.call(b0,b3)}else{bF.merge(b0,b3)}}return b0},inArray:function(b2,b3,b1){var b0;if(b3){if(bv){return bv.call(b3,b2,b1)}b0=b3.length;b1=b1?b1<0?Math.max(0,b0+b1):b1:0;for(;b1<b0;b1++){if(b1 in b3&&b3[b1]===b2){return b1}}}return -1},merge:function(b4,b2){var b3=b4.length,b1=0;if(typeof b2.length==="number"){for(var b0=b2.length;b1<b0;b1++){b4[b3++]=b2[b1]}}else{while(b2[b1]!==L){b4[b3++]=b2[b1++]}}b4.length=b3;return b4},grep:function(b1,b6,b0){var b2=[],b5;b0=!!b0;for(var b3=0,b4=b1.length;b3<b4;b3++){b5=!!b6(b1[b3],b3);if(b0!==b5){b2.push(b1[b3])}}return b2},map:function(b0,b7,b8){var b5,b6,b4=[],b2=0,b1=b0.length,b3=b0 instanceof bF||b1!==L&&typeof b1==="number"&&((b1>0&&b0[0]&&b0[b1-1])||b1===0||bF.isArray(b0));if(b3){for(;b2<b1;b2++){b5=b7(b0[b2],b2,b8);if(b5!=null){b4[b4.length]=b5}}}else{for(b6 in b0){b5=b7(b0[b6],b6,b8);if(b5!=null){b4[b4.length]=b5}}}return b4.concat.apply([],b4)},guid:1,proxy:function(b4,b3){if(typeof b3==="string"){var b2=b4[b3];b3=b4;b4=b2}if(!bF.isFunction(b4)){return L}var b0=bK.call(arguments,2),b1=function(){return b4.apply(b3,b0.concat(bK.call(arguments)))};b1.guid=b4.guid=b4.guid||b1.guid||bF.guid++;return b1},access:function(b0,b8,b6,b2,b5,b7){var b1=b0.length;if(typeof b8==="object"){for(var b3 in b8){bF.access(b0,b3,b8[b3],b2,b5,b6)}return b0}if(b6!==L){b2=!b7&&b2&&bF.isFunction(b6);for(var b4=0;b4<b1;b4++){b5(b0[b4],b8,b2?b6.call(b0[b4],b4,b5(b0[b4],b8)):b6,b7)}return b0}return b1?b5(b0[0],b8):L},now:function(){return(new Date()).getTime()},uaMatch:function(b1){b1=b1.toLowerCase();var b0=by.exec(b1)||bR.exec(b1)||bQ.exec(b1)||b1.indexOf("compatible")<0&&bS.exec(b1)||[];return{browser:b0[1]||"",version:b0[2]||"0"}},sub:function(){function b0(b3,b4){return new b0.fn.init(b3,b4)}bF.extend(true,b0,this);b0.superclass=this;b0.fn=b0.prototype=this();b0.fn.constructor=b0;b0.sub=this.sub;b0.fn.init=function b2(b3,b4){if(b4&&b4 instanceof bF&&!(b4 instanceof b0)){b4=b0(b4)}return bF.fn.init.call(this,b3,b4,b1)};b0.fn.init.prototype=b0.fn;var b1=b0(av);return b0},browser:{}});bF.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(b1,b0){bx["[object "+b0+"]"]=b0.toLowerCase()});bV=bF.uaMatch(bX);if(bV.browser){bF.browser[bV.browser]=true;bF.browser.version=bV.version}if(bF.browser.webkit){bF.browser.safari=true}if(bM.test("\xA0")){bI=/^[\s\xA0]+/;bE=/[\s\xA0]+$/}bD=bF(av);if(av.addEventListener){e=function(){av.removeEventListener("DOMContentLoaded",e,false);bF.ready()}}else{if(av.attachEvent){e=function(){if(av.readyState==="complete"){av.detachEvent("onreadystatechange",e);bF.ready()}}}}function bw(){if(bF.isReady){return}try{av.documentElement.doScroll("left")}catch(b0){setTimeout(bw,1);return}bF.ready()}return bF})();var a2={};function X(e){var bv=a2[e]={},bw,bx;e=e.split(/\s+/);for(bw=0,bx=e.length;bw<bx;bw++){bv[e[bw]]=true}return bv}b.Callbacks=function(bw){bw=bw?(a2[bw]||X(bw)):{};var bB=[],bC=[],bx,by,bv,bz,bA,bE=function(bF){var bG,bJ,bI,bH,bK;for(bG=0,bJ=bF.length;bG<bJ;bG++){bI=bF[bG];bH=b.type(bI);if(bH==="array"){bE(bI)}else{if(bH==="function"){if(!bw.unique||!bD.has(bI)){bB.push(bI)}}}}},e=function(bG,bF){bF=bF||[];bx=!bw.memory||[bG,bF];by=true;bA=bv||0;bv=0;bz=bB.length;for(;bB&&bA<bz;bA++){if(bB[bA].apply(bG,bF)===false&&bw.stopOnFalse){bx=true;break}}by=false;if(bB){if(!bw.once){if(bC&&bC.length){bx=bC.shift();bD.fireWith(bx[0],bx[1])}}else{if(bx===true){bD.disable()}else{bB=[]}}}},bD={add:function(){if(bB){var bF=bB.length;bE(arguments);if(by){bz=bB.length}else{if(bx&&bx!==true){bv=bF;e(bx[0],bx[1])}}}return this},remove:function(){if(bB){var bF=arguments,bH=0,bI=bF.length;for(;bH<bI;bH++){for(var bG=0;bG<bB.length;bG++){if(bF[bH]===bB[bG]){if(by){if(bG<=bz){bz--;if(bG<=bA){bA--}}}bB.splice(bG--,1);if(bw.unique){break}}}}}return this},has:function(bG){if(bB){var bF=0,bH=bB.length;for(;bF<bH;bF++){if(bG===bB[bF]){return true}}}return false},empty:function(){bB=[];return this},disable:function(){bB=bC=bx=L;return this},disabled:function(){return !bB},lock:function(){bC=L;if(!bx||bx===true){bD.disable()}return this},locked:function(){return !bC},fireWith:function(bG,bF){if(bC){if(by){if(!bw.once){bC.push([bG,bF])}}else{if(!(bw.once&&bx)){e(bG,bF)}}}return this},fire:function(){bD.fireWith(this,arguments);return this},fired:function(){return !!bx}};return bD};var aJ=[].slice;b.extend({Deferred:function(by){var bx=b.Callbacks("once memory"),bw=b.Callbacks("once memory"),bv=b.Callbacks("memory"),e="pending",bA={resolve:bx,reject:bw,notify:bv},bC={done:bx.add,fail:bw.add,progress:bv.add,state:function(){return e},isResolved:bx.fired,isRejected:bw.fired,then:function(bE,bD,bF){bB.done(bE).fail(bD).progress(bF);return this},always:function(){bB.done.apply(bB,arguments).fail.apply(bB,arguments);return this},pipe:function(bF,bE,bD){return b.Deferred(function(bG){b.each({done:[bF,"resolve"],fail:[bE,"reject"],progress:[bD,"notify"]},function(bI,bL){var bH=bL[0],bK=bL[1],bJ;if(b.isFunction(bH)){bB[bI](function(){bJ=bH.apply(this,arguments);if(bJ&&b.isFunction(bJ.promise)){bJ.promise().then(bG.resolve,bG.reject,bG.notify)}else{bG[bK+"With"](this===bB?bG:this,[bJ])}})}else{bB[bI](bG[bK])}})}).promise()},promise:function(bE){if(bE==null){bE=bC}else{for(var bD in bC){bE[bD]=bC[bD]}}return bE}},bB=bC.promise({}),bz;for(bz in bA){bB[bz]=bA[bz].fire;bB[bz+"With"]=bA[bz].fireWith}bB.done(function(){e="resolved"},bw.disable,bv.lock).fail(function(){e="rejected"},bx.disable,bv.lock);if(by){by.call(bB,bB)}return bB},when:function(bA){var bx=aJ.call(arguments,0),bv=0,e=bx.length,bB=new Array(e),bw=e,by=e,bC=e<=1&&bA&&b.isFunction(bA.promise)?bA:b.Deferred(),bE=bC.promise();function bD(bF){return function(bG){bx[bF]=arguments.length>1?aJ.call(arguments,0):bG;if(!(--bw)){bC.resolveWith(bC,bx)}}}function bz(bF){return function(bG){bB[bF]=arguments.length>1?aJ.call(arguments,0):bG;bC.notifyWith(bE,bB)}}if(e>1){for(;bv<e;bv++){if(bx[bv]&&bx[bv].promise&&b.isFunction(bx[bv].promise)){bx[bv].promise().then(bD(bv),bC.reject,bz(bv))}else{--bw}}if(!bw){bC.resolveWith(bC,bx)}}else{if(bC!==bA){bC.resolveWith(bC,e?[bA]:[])}}return bE}});b.support=(function(){var bJ,bI,bF,bG,bx,bE,bA,bD,bz,bK,bB,by,bw,bv=av.createElement("div"),bH=av.documentElement;bv.setAttribute("className","t");bv.innerHTML="   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";bI=bv.getElementsByTagName("*");bF=bv.getElementsByTagName("a")[0];if(!bI||!bI.length||!bF){return{}}bG=av.createElement("select");bx=bG.appendChild(av.createElement("option"));bE=bv.getElementsByTagName("input")[0];bJ={leadingWhitespace:(bv.firstChild.nodeType===3),tbody:!bv.getElementsByTagName("tbody").length,htmlSerialize:!!bv.getElementsByTagName("link").length,style:/top/.test(bF.getAttribute("style")),hrefNormalized:(bF.getAttribute("href")==="/a"),opacity:/^0.55/.test(bF.style.opacity),cssFloat:!!bF.style.cssFloat,checkOn:(bE.value==="on"),optSelected:bx.selected,getSetAttribute:bv.className!=="t",enctype:!!av.createElement("form").enctype,html5Clone:av.createElement("nav").cloneNode(true).outerHTML!=="<:nav></:nav>",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};bE.checked=true;bJ.noCloneChecked=bE.cloneNode(true).checked;bG.disabled=true;bJ.optDisabled=!bx.disabled;try{delete bv.test}catch(bC){bJ.deleteExpando=false}if(!bv.addEventListener&&bv.attachEvent&&bv.fireEvent){bv.attachEvent("onclick",function(){bJ.noCloneEvent=false});bv.cloneNode(true).fireEvent("onclick")}bE=av.createElement("input");bE.value="t";bE.setAttribute("type","radio");bJ.radioValue=bE.value==="t";bE.setAttribute("checked","checked");bv.appendChild(bE);bD=av.createDocumentFragment();bD.appendChild(bv.lastChild);bJ.checkClone=bD.cloneNode(true).cloneNode(true).lastChild.checked;bJ.appendChecked=bE.checked;bD.removeChild(bE);bD.appendChild(bv);bv.innerHTML="";if(bb.getComputedStyle){bA=av.createElement("div");bA.style.width="0";bA.style.marginRight="0";bv.style.width="2px";bv.appendChild(bA);bJ.reliableMarginRight=(parseInt((bb.getComputedStyle(bA,null)||{marginRight:0}).marginRight,10)||0)===0}if(bv.attachEvent){for(by in {submit:1,change:1,focusin:1}){bB="on"+by;bw=(bB in bv);if(!bw){bv.setAttribute(bB,"return;");bw=(typeof bv[bB]==="function")}bJ[by+"Bubbles"]=bw}}bD.removeChild(bv);bD=bG=bx=bA=bv=bE=null;b(function(){var bM,bU,bV,bT,bN,bO,bL,bS,bR,e,bP,bQ=av.getElementsByTagName("body")[0];if(!bQ){return}bL=1;bS="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";bR="visibility:hidden;border:0;";e="style='"+bS+"border:5px solid #000;padding:0;'";bP="<div "+e+"><div></div></div><table "+e+" cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";bM=av.createElement("div");bM.style.cssText=bR+"width:0;height:0;position:static;top:0;margin-top:"+bL+"px";bQ.insertBefore(bM,bQ.firstChild);bv=av.createElement("div");bM.appendChild(bv);bv.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";bz=bv.getElementsByTagName("td");bw=(bz[0].offsetHeight===0);bz[0].style.display="";bz[1].style.display="none";bJ.reliableHiddenOffsets=bw&&(bz[0].offsetHeight===0);bv.innerHTML="";bv.style.width=bv.style.paddingLeft="1px";b.boxModel=bJ.boxModel=bv.offsetWidth===2;if(typeof bv.style.zoom!=="undefined"){bv.style.display="inline";bv.style.zoom=1;bJ.inlineBlockNeedsLayout=(bv.offsetWidth===2);bv.style.display="";bv.innerHTML="<div style='width:4px;'></div>";bJ.shrinkWrapBlocks=(bv.offsetWidth!==2)}bv.style.cssText=bS+bR;bv.innerHTML=bP;bU=bv.firstChild;bV=bU.firstChild;bN=bU.nextSibling.firstChild.firstChild;bO={doesNotAddBorder:(bV.offsetTop!==5),doesAddBorderForTableAndCells:(bN.offsetTop===5)};bV.style.position="fixed";bV.style.top="20px";bO.fixedPosition=(bV.offsetTop===20||bV.offsetTop===15);bV.style.position=bV.style.top="";bU.style.overflow="hidden";bU.style.position="relative";bO.subtractsBorderForOverflowNotVisible=(bV.offsetTop===-5);bO.doesNotIncludeMarginInBodyOffset=(bQ.offsetTop!==bL);bQ.removeChild(bM);bv=bM=null;b.extend(bJ,bO)});return bJ})();var aS=/^(?:\{.*\}|\[.*\])$/,aA=/([A-Z])/g;b.extend({cache:{},uuid:0,expando:"jQuery"+(b.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(e){e=e.nodeType?b.cache[e[b.expando]]:e[b.expando];return !!e&&!S(e)},data:function(bx,bv,bz,by){if(!b.acceptData(bx)){return}var bG,bA,bD,bE=b.expando,bC=typeof bv==="string",bF=bx.nodeType,e=bF?b.cache:bx,bw=bF?bx[bE]:bx[bE]&&bE,bB=bv==="events";if((!bw||!e[bw]||(!bB&&!by&&!e[bw].data))&&bC&&bz===L){return}if(!bw){if(bF){bx[bE]=bw=++b.uuid}else{bw=bE}}if(!e[bw]){e[bw]={};if(!bF){e[bw].toJSON=b.noop}}if(typeof bv==="object"||typeof bv==="function"){if(by){e[bw]=b.extend(e[bw],bv)}else{e[bw].data=b.extend(e[bw].data,bv)}}bG=bA=e[bw];if(!by){if(!bA.data){bA.data={}}bA=bA.data}if(bz!==L){bA[b.camelCase(bv)]=bz}if(bB&&!bA[bv]){return bG.events}if(bC){bD=bA[bv];if(bD==null){bD=bA[b.camelCase(bv)]}}else{bD=bA}return bD},removeData:function(bx,bv,by){if(!b.acceptData(bx)){return}var bB,bA,bz,bC=b.expando,bD=bx.nodeType,e=bD?b.cache:bx,bw=bD?bx[bC]:bC;if(!e[bw]){return}if(bv){bB=by?e[bw]:e[bw].data;if(bB){if(!b.isArray(bv)){if(bv in bB){bv=[bv]}else{bv=b.camelCase(bv);if(bv in bB){bv=[bv]}else{bv=bv.split(" ")}}}for(bA=0,bz=bv.length;bA<bz;bA++){delete bB[bv[bA]]}if(!(by?S:b.isEmptyObject)(bB)){return}}}if(!by){delete e[bw].data;if(!S(e[bw])){return}}if(b.support.deleteExpando||!e.setInterval){delete e[bw]}else{e[bw]=null}if(bD){if(b.support.deleteExpando){delete bx[bC]}else{if(bx.removeAttribute){bx.removeAttribute(bC)}else{bx[bC]=null}}}},_data:function(bv,e,bw){return b.data(bv,e,bw,true)},acceptData:function(bv){if(bv.nodeName){var e=b.noData[bv.nodeName.toLowerCase()];if(e){return !(e===true||bv.getAttribute("classid")!==e)}}return true}});b.fn.extend({data:function(by,bA){var bB,e,bw,bz=null;if(typeof by==="undefined"){if(this.length){bz=b.data(this[0]);if(this[0].nodeType===1&&!b._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var bx=0,bv=e.length;bx<bv;bx++){bw=e[bx].name;if(bw.indexOf("data-")===0){bw=b.camelCase(bw.substring(5));a5(this[0],bw,bz[bw])}}b._data(this[0],"parsedAttrs",true)}}return bz}else{if(typeof by==="object"){return this.each(function(){b.data(this,by)})}}bB=by.split(".");bB[1]=bB[1]?"."+bB[1]:"";if(bA===L){bz=this.triggerHandler("getData"+bB[1]+"!",[bB[0]]);if(bz===L&&this.length){bz=b.data(this[0],by);bz=a5(this[0],by,bz)}return bz===L&&bB[1]?this.data(bB[0]):bz}else{return this.each(function(){var bC=b(this),bD=[bB[0],bA];bC.triggerHandler("setData"+bB[1]+"!",bD);b.data(this,by,bA);bC.triggerHandler("changeData"+bB[1]+"!",bD)})}},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function a5(bx,bw,by){if(by===L&&bx.nodeType===1){var bv="data-"+bw.replace(aA,"-$1").toLowerCase();by=bx.getAttribute(bv);if(typeof by==="string"){try{by=by==="true"?true:by==="false"?false:by==="null"?null:b.isNumeric(by)?parseFloat(by):aS.test(by)?b.parseJSON(by):by}catch(bz){}b.data(bx,bw,by)}else{by=L}}return by}function S(bv){for(var e in bv){if(e==="data"&&b.isEmptyObject(bv[e])){continue}if(e!=="toJSON"){return false}}return true}function bi(by,bx,bA){var bw=bx+"defer",bv=bx+"queue",e=bx+"mark",bz=b._data(by,bw);if(bz&&(bA==="queue"||!b._data(by,bv))&&(bA==="mark"||!b._data(by,e))){setTimeout(function(){if(!b._data(by,bv)&&!b._data(by,e)){b.removeData(by,bw,true);bz.fire()}},0)}}b.extend({_mark:function(bv,e){if(bv){e=(e||"fx")+"mark";b._data(bv,e,(b._data(bv,e)||0)+1)}},_unmark:function(by,bx,bv){if(by!==true){bv=bx;bx=by;by=false}if(bx){bv=bv||"fx";var e=bv+"mark",bw=by?0:((b._data(bx,e)||1)-1);if(bw){b._data(bx,e,bw)}else{b.removeData(bx,e,true);bi(bx,bv,"mark")}}},queue:function(bv,e,bx){var bw;if(bv){e=(e||"fx")+"queue";bw=b._data(bv,e);if(bx){if(!bw||b.isArray(bx)){bw=b._data(bv,e,b.makeArray(bx))}else{bw.push(bx)}}return bw||[]}},dequeue:function(by,bx){bx=bx||"fx";var bv=b.queue(by,bx),bw=bv.shift(),e={};if(bw==="inprogress"){bw=bv.shift()}if(bw){if(bx==="fx"){bv.unshift("inprogress")}b._data(by,bx+".run",e);bw.call(by,function(){b.dequeue(by,bx)},e)}if(!bv.length){b.removeData(by,bx+"queue "+bx+".run",true);bi(by,bx,"queue")}}});b.fn.extend({queue:function(e,bv){if(typeof e!=="string"){bv=e;e="fx"}if(bv===L){return b.queue(this[0],e)}return this.each(function(){var bw=b.queue(this,e,bv);if(e==="fx"&&bw[0]!=="inprogress"){b.dequeue(this,e)}})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(bv,e){bv=b.fx?b.fx.speeds[bv]||bv:bv;e=e||"fx";return this.queue(e,function(bx,bw){var by=setTimeout(bx,bv);bw.stop=function(){clearTimeout(by)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(bD,bw){if(typeof bD!=="string"){bw=bD;bD=L}bD=bD||"fx";var e=b.Deferred(),bv=this,by=bv.length,bB=1,bz=bD+"defer",bA=bD+"queue",bC=bD+"mark",bx;function bE(){if(!(--bB)){e.resolveWith(bv,[bv])}}while(by--){if((bx=b.data(bv[by],bz,L,true)||(b.data(bv[by],bA,L,true)||b.data(bv[by],bC,L,true))&&b.data(bv[by],bz,b.Callbacks("once memory"),true))){bB++;bx.add(bE)}}bE();return e.promise()}});var aP=/[\n\t\r]/g,af=/\s+/,aU=/\r/g,g=/^(?:button|input)$/i,D=/^(?:button|input|object|select|textarea)$/i,l=/^a(?:rea)?$/i,ao=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,F=b.support.getSetAttribute,be,aY,aF;b.fn.extend({attr:function(e,bv){return b.access(this,e,bv,true,b.attr)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,bv){return b.access(this,e,bv,true,b.prop)},removeProp:function(e){e=b.propFix[e]||e;return this.each(function(){try{this[e]=L;delete this[e]}catch(bv){}})},addClass:function(by){var bA,bw,bv,bx,bz,bB,e;if(b.isFunction(by)){return this.each(function(bC){b(this).addClass(by.call(this,bC,this.className))})}if(by&&typeof by==="string"){bA=by.split(af);for(bw=0,bv=this.length;bw<bv;bw++){bx=this[bw];if(bx.nodeType===1){if(!bx.className&&bA.length===1){bx.className=by}else{bz=" "+bx.className+" ";for(bB=0,e=bA.length;bB<e;bB++){if(!~bz.indexOf(" "+bA[bB]+" ")){bz+=bA[bB]+" "}}bx.className=b.trim(bz)}}}}return this},removeClass:function(bz){var bA,bw,bv,by,bx,bB,e;if(b.isFunction(bz)){return this.each(function(bC){b(this).removeClass(bz.call(this,bC,this.className))})}if((bz&&typeof bz==="string")||bz===L){bA=(bz||"").split(af);for(bw=0,bv=this.length;bw<bv;bw++){by=this[bw];if(by.nodeType===1&&by.className){if(bz){bx=(" "+by.className+" ").replace(aP," ");for(bB=0,e=bA.length;bB<e;bB++){bx=bx.replace(" "+bA[bB]+" "," ")}by.className=b.trim(bx)}else{by.className=""}}}}return this},toggleClass:function(bx,bv){var bw=typeof bx,e=typeof bv==="boolean";if(b.isFunction(bx)){return this.each(function(by){b(this).toggleClass(bx.call(this,by,this.className,bv),bv)})}return this.each(function(){if(bw==="string"){var bA,bz=0,by=b(this),bB=bv,bC=bx.split(af);while((bA=bC[bz++])){bB=e?bB:!by.hasClass(bA);by[bB?"addClass":"removeClass"](bA)}}else{if(bw==="undefined"||bw==="boolean"){if(this.className){b._data(this,"__className__",this.className)}this.className=this.className||bx===false?"":b._data(this,"__className__")||""}}})},hasClass:function(e){var bx=" "+e+" ",bw=0,bv=this.length;for(;bw<bv;bw++){if(this[bw].nodeType===1&&(" "+this[bw].className+" ").replace(aP," ").indexOf(bx)>-1){return true}}return false},val:function(bx){var e,bv,by,bw=this[0];if(!arguments.length){if(bw){e=b.valHooks[bw.nodeName.toLowerCase()]||b.valHooks[bw.type];if(e&&"get" in e&&(bv=e.get(bw,"value"))!==L){return bv}bv=bw.value;return typeof bv==="string"?bv.replace(aU,""):bv==null?"":bv}return}by=b.isFunction(bx);return this.each(function(bA){var bz=b(this),bB;if(this.nodeType!==1){return}if(by){bB=bx.call(this,bA,bz.val())}else{bB=bx}if(bB==null){bB=""}else{if(typeof bB==="number"){bB+=""}else{if(b.isArray(bB)){bB=b.map(bB,function(bC){return bC==null?"":bC+""})}}}e=b.valHooks[this.nodeName.toLowerCase()]||b.valHooks[this.type];if(!e||!("set" in e)||e.set(this,bB,"value")===L){this.value=bB}})}});b.extend({valHooks:{option:{get:function(e){var bv=e.attributes.value;return !bv||bv.specified?e.value:e.text}},select:{get:function(e){var bA,bv,bz,bx,by=e.selectedIndex,bB=[],bC=e.options,bw=e.type==="select-one";if(by<0){return null}bv=bw?by:0;bz=bw?by+1:bC.length;for(;bv<bz;bv++){bx=bC[bv];if(bx.selected&&(b.support.optDisabled?!bx.disabled:bx.getAttribute("disabled")===null)&&(!bx.parentNode.disabled||!b.nodeName(bx.parentNode,"optgroup"))){bA=b(bx).val();if(bw){return bA}bB.push(bA)}}if(bw&&!bB.length&&bC.length){return b(bC[by]).val()}return bB},set:function(bv,bw){var e=b.makeArray(bw);b(bv).find("option").each(function(){this.selected=b.inArray(b(this).val(),e)>=0});if(!e.length){bv.selectedIndex=-1}return e}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(bA,bx,bB,bz){var bw,e,by,bv=bA.nodeType;if(!bA||bv===3||bv===8||bv===2){return}if(bz&&bx in b.attrFn){return b(bA)[bx](bB)}if(typeof bA.getAttribute==="undefined"){return b.prop(bA,bx,bB)}by=bv!==1||!b.isXMLDoc(bA);if(by){bx=bx.toLowerCase();e=b.attrHooks[bx]||(ao.test(bx)?aY:be)}if(bB!==L){if(bB===null){b.removeAttr(bA,bx);return}else{if(e&&"set" in e&&by&&(bw=e.set(bA,bB,bx))!==L){return bw}else{bA.setAttribute(bx,""+bB);return bB}}}else{if(e&&"get" in e&&by&&(bw=e.get(bA,bx))!==null){return bw}else{bw=bA.getAttribute(bx);return bw===null?L:bw}}},removeAttr:function(bx,bz){var by,bA,bv,e,bw=0;if(bz&&bx.nodeType===1){bA=bz.toLowerCase().split(af);e=bA.length;for(;bw<e;bw++){bv=bA[bw];if(bv){by=b.propFix[bv]||bv;b.attr(bx,bv,"");bx.removeAttribute(F?bv:by);if(ao.test(bv)&&by in bx){bx[by]=false}}}}},attrHooks:{type:{set:function(e,bv){if(g.test(e.nodeName)&&e.parentNode){b.error("type property can't be changed")}else{if(!b.support.radioValue&&bv==="radio"&&b.nodeName(e,"input")){var bw=e.value;e.setAttribute("type",bv);if(bw){e.value=bw}return bv}}}},value:{get:function(bv,e){if(be&&b.nodeName(bv,"button")){return be.get(bv,e)}return e in bv?bv.value:null},set:function(bv,bw,e){if(be&&b.nodeName(bv,"button")){return be.set(bv,bw,e)}bv.value=bw}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(bz,bx,bA){var bw,e,by,bv=bz.nodeType;if(!bz||bv===3||bv===8||bv===2){return}by=bv!==1||!b.isXMLDoc(bz);if(by){bx=b.propFix[bx]||bx;e=b.propHooks[bx]}if(bA!==L){if(e&&"set" in e&&(bw=e.set(bz,bA,bx))!==L){return bw}else{return(bz[bx]=bA)}}else{if(e&&"get" in e&&(bw=e.get(bz,bx))!==null){return bw}else{return bz[bx]}}},propHooks:{tabIndex:{get:function(bv){var e=bv.getAttributeNode("tabindex");return e&&e.specified?parseInt(e.value,10):D.test(bv.nodeName)||l.test(bv.nodeName)&&bv.href?0:L}}}});b.attrHooks.tabindex=b.propHooks.tabIndex;aY={get:function(bv,e){var bx,bw=b.prop(bv,e);return bw===true||typeof bw!=="boolean"&&(bx=bv.getAttributeNode(e))&&bx.nodeValue!==false?e.toLowerCase():L},set:function(bv,bx,e){var bw;if(bx===false){b.removeAttr(bv,e)}else{bw=b.propFix[e]||e;if(bw in bv){bv[bw]=true}bv.setAttribute(e,e.toLowerCase())}return e}};if(!F){aF={name:true,id:true};be=b.valHooks.button={get:function(bw,bv){var e;e=bw.getAttributeNode(bv);return e&&(aF[bv]?e.nodeValue!=="":e.specified)?e.nodeValue:L},set:function(bw,bx,bv){var e=bw.getAttributeNode(bv);if(!e){e=av.createAttribute(bv);bw.setAttributeNode(e)}return(e.nodeValue=bx+"")}};b.attrHooks.tabindex.set=be.set;b.each(["width","height"],function(bv,e){b.attrHooks[e]=b.extend(b.attrHooks[e],{set:function(bw,bx){if(bx===""){bw.setAttribute(e,"auto");return bx}}})});b.attrHooks.contenteditable={get:be.get,set:function(bv,bw,e){if(bw===""){bw="false"}be.set(bv,bw,e)}}}if(!b.support.hrefNormalized){b.each(["href","src","width","height"],function(bv,e){b.attrHooks[e]=b.extend(b.attrHooks[e],{get:function(bx){var bw=bx.getAttribute(e,2);return bw===null?L:bw}})})}if(!b.support.style){b.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||L},set:function(e,bv){return(e.style.cssText=""+bv)}}}if(!b.support.optSelected){b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(bv){var e=bv.parentNode;if(e){e.selectedIndex;if(e.parentNode){e.parentNode.selectedIndex}}return null}})}if(!b.support.enctype){b.propFix.enctype="encoding"}if(!b.support.checkOn){b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}})}b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,bv){if(b.isArray(bv)){return(e.checked=b.inArray(b(e).val(),bv)>=0)}}})});var bd=/^(?:textarea|input|select)$/i,n=/^([^\.]*)?(?:\.(.+))?$/,J=/\bhover(\.\S+)?\b/,aO=/^key/,bf=/^(?:mouse|contextmenu)|click/,T=/^(?:focusinfocus|focusoutblur)$/,U=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,Y=function(e){var bv=U.exec(e);if(bv){bv[1]=(bv[1]||"").toLowerCase();bv[3]=bv[3]&&new RegExp("(?:^|\\s)"+bv[3]+"(?:\\s|$)")}return bv},j=function(bw,e){var bv=bw.attributes||{};return((!e[1]||bw.nodeName.toLowerCase()===e[1])&&(!e[2]||(bv.id||{}).value===e[2])&&(!e[3]||e[3].test((bv["class"]||{}).value)))},bt=function(e){return b.event.special.hover?e:e.replace(J,"mouseenter$1 mouseleave$1")};b.event={add:function(bx,bC,bJ,bA,by){var bD,bB,bK,bI,bH,bF,e,bG,bv,bz,bw,bE;if(bx.nodeType===3||bx.nodeType===8||!bC||!bJ||!(bD=b._data(bx))){return}if(bJ.handler){bv=bJ;bJ=bv.handler}if(!bJ.guid){bJ.guid=b.guid++}bK=bD.events;if(!bK){bD.events=bK={}}bB=bD.handle;if(!bB){bD.handle=bB=function(bL){return typeof b!=="undefined"&&(!bL||b.event.triggered!==bL.type)?b.event.dispatch.apply(bB.elem,arguments):L};bB.elem=bx}bC=b.trim(bt(bC)).split(" ");for(bI=0;bI<bC.length;bI++){bH=n.exec(bC[bI])||[];bF=bH[1];e=(bH[2]||"").split(".").sort();bE=b.event.special[bF]||{};bF=(by?bE.delegateType:bE.bindType)||bF;bE=b.event.special[bF]||{};bG=b.extend({type:bF,origType:bH[1],data:bA,handler:bJ,guid:bJ.guid,selector:by,quick:Y(by),namespace:e.join(".")},bv);bw=bK[bF];if(!bw){bw=bK[bF]=[];bw.delegateCount=0;if(!bE.setup||bE.setup.call(bx,bA,e,bB)===false){if(bx.addEventListener){bx.addEventListener(bF,bB,false)}else{if(bx.attachEvent){bx.attachEvent("on"+bF,bB)}}}}if(bE.add){bE.add.call(bx,bG);if(!bG.handler.guid){bG.handler.guid=bJ.guid}}if(by){bw.splice(bw.delegateCount++,0,bG)}else{bw.push(bG)}b.event.global[bF]=true}bx=null},global:{},remove:function(bJ,bE,bv,bH,bB){var bI=b.hasData(bJ)&&b._data(bJ),bF,bx,bz,bL,bC,bA,bG,bw,by,bK,bD,e;if(!bI||!(bw=bI.events)){return}bE=b.trim(bt(bE||"")).split(" ");for(bF=0;bF<bE.length;bF++){bx=n.exec(bE[bF])||[];bz=bL=bx[1];bC=bx[2];if(!bz){for(bz in bw){b.event.remove(bJ,bz+bE[bF],bv,bH,true)}continue}by=b.event.special[bz]||{};bz=(bH?by.delegateType:by.bindType)||bz;bD=bw[bz]||[];bA=bD.length;bC=bC?new RegExp("(^|\\.)"+bC.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(bG=0;bG<bD.length;bG++){e=bD[bG];if((bB||bL===e.origType)&&(!bv||bv.guid===e.guid)&&(!bC||bC.test(e.namespace))&&(!bH||bH===e.selector||bH==="**"&&e.selector)){bD.splice(bG--,1);if(e.selector){bD.delegateCount--}if(by.remove){by.remove.call(bJ,e)}}}if(bD.length===0&&bA!==bD.length){if(!by.teardown||by.teardown.call(bJ,bC)===false){b.removeEvent(bJ,bz,bI.handle)}delete bw[bz]}}if(b.isEmptyObject(bw)){bK=bI.handle;if(bK){bK.elem=null}b.removeData(bJ,["events","handle"],true)}},customEvent:{getData:true,setData:true,changeData:true},trigger:function(bv,bD,bA,bJ){if(bA&&(bA.nodeType===3||bA.nodeType===8)){return}var bG=bv.type||bv,bx=[],e,bw,bC,bH,bz,by,bF,bE,bB,bI;if(T.test(bG+b.event.triggered)){return}if(bG.indexOf("!")>=0){bG=bG.slice(0,-1);bw=true}if(bG.indexOf(".")>=0){bx=bG.split(".");bG=bx.shift();bx.sort()}if((!bA||b.event.customEvent[bG])&&!b.event.global[bG]){return}bv=typeof bv==="object"?bv[b.expando]?bv:new b.Event(bG,bv):new b.Event(bG);bv.type=bG;bv.isTrigger=true;bv.exclusive=bw;bv.namespace=bx.join(".");bv.namespace_re=bv.namespace?new RegExp("(^|\\.)"+bx.join("\\.(?:.*\\.)?")+"(\\.|$)"):null;by=bG.indexOf(":")<0?"on"+bG:"";if(!bA){e=b.cache;for(bC in e){if(e[bC].events&&e[bC].events[bG]){b.event.trigger(bv,bD,e[bC].handle.elem,true)}}return}bv.result=L;if(!bv.target){bv.target=bA}bD=bD!=null?b.makeArray(bD):[];bD.unshift(bv);bF=b.event.special[bG]||{};if(bF.trigger&&bF.trigger.apply(bA,bD)===false){return}bB=[[bA,bF.bindType||bG]];if(!bJ&&!bF.noBubble&&!b.isWindow(bA)){bI=bF.delegateType||bG;bH=T.test(bI+bG)?bA:bA.parentNode;bz=null;for(;bH;bH=bH.parentNode){bB.push([bH,bI]);bz=bH}if(bz&&bz===bA.ownerDocument){bB.push([bz.defaultView||bz.parentWindow||bb,bI])}}for(bC=0;bC<bB.length&&!bv.isPropagationStopped();bC++){bH=bB[bC][0];bv.type=bB[bC][1];bE=(b._data(bH,"events")||{})[bv.type]&&b._data(bH,"handle");if(bE){bE.apply(bH,bD)}bE=by&&bH[by];if(bE&&b.acceptData(bH)&&bE.apply(bH,bD)===false){bv.preventDefault()}}bv.type=bG;if(!bJ&&!bv.isDefaultPrevented()){if((!bF._default||bF._default.apply(bA.ownerDocument,bD)===false)&&!(bG==="click"&&b.nodeName(bA,"a"))&&b.acceptData(bA)){if(by&&bA[bG]&&((bG!=="focus"&&bG!=="blur")||bv.target.offsetWidth!==0)&&!b.isWindow(bA)){bz=bA[by];if(bz){bA[by]=null}b.event.triggered=bG;bA[bG]();b.event.triggered=L;if(bz){bA[by]=bz}}}}return bv.result},dispatch:function(e){e=b.event.fix(e||bb.event);var bz=((b._data(this,"events")||{})[e.type]||[]),bA=bz.delegateCount,bG=[].slice.call(arguments,0),by=!e.exclusive&&!e.namespace,bH=[],bC,bB,bK,bx,bF,bE,bv,bD,bI,bw,bJ;bG[0]=e;e.delegateTarget=this;if(bA&&!e.target.disabled&&!(e.button&&e.type==="click")){bx=b(this);bx.context=this.ownerDocument||this;for(bK=e.target;bK!=this;bK=bK.parentNode||this){bE={};bD=[];bx[0]=bK;for(bC=0;bC<bA;bC++){bI=bz[bC];bw=bI.selector;if(bE[bw]===L){bE[bw]=(bI.quick?j(bK,bI.quick):bx.is(bw))}if(bE[bw]){bD.push(bI)}}if(bD.length){bH.push({elem:bK,matches:bD})}}}if(bz.length>bA){bH.push({elem:this,matches:bz.slice(bA)})}for(bC=0;bC<bH.length&&!e.isPropagationStopped();bC++){bv=bH[bC];e.currentTarget=bv.elem;for(bB=0;bB<bv.matches.length&&!e.isImmediatePropagationStopped();bB++){bI=bv.matches[bB];if(by||(!e.namespace&&!bI.namespace)||e.namespace_re&&e.namespace_re.test(bI.namespace)){e.data=bI.data;e.handleObj=bI;bF=((b.event.special[bI.origType]||{}).handle||bI.handler).apply(bv.elem,bG);if(bF!==L){e.result=bF;if(bF===false){e.preventDefault();e.stopPropagation()}}}}}return e.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(bv,e){if(bv.which==null){bv.which=e.charCode!=null?e.charCode:e.keyCode}return bv}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(bx,bw){var by,bz,e,bv=bw.button,bA=bw.fromElement;if(bx.pageX==null&&bw.clientX!=null){by=bx.target.ownerDocument||av;bz=by.documentElement;e=by.body;bx.pageX=bw.clientX+(bz&&bz.scrollLeft||e&&e.scrollLeft||0)-(bz&&bz.clientLeft||e&&e.clientLeft||0);bx.pageY=bw.clientY+(bz&&bz.scrollTop||e&&e.scrollTop||0)-(bz&&bz.clientTop||e&&e.clientTop||0)}if(!bx.relatedTarget&&bA){bx.relatedTarget=bA===bx.target?bw.toElement:bA}if(!bx.which&&bv!==L){bx.which=(bv&1?1:(bv&2?3:(bv&4?2:0)))}return bx}},fix:function(bw){if(bw[b.expando]){return bw}var bv,bz,e=bw,bx=b.event.fixHooks[bw.type]||{},by=bx.props?this.props.concat(bx.props):this.props;bw=b.Event(e);for(bv=by.length;bv;){bz=by[--bv];bw[bz]=e[bz]}if(!bw.target){bw.target=e.srcElement||av}if(bw.target.nodeType===3){bw.target=bw.target.parentNode}if(bw.metaKey===L){bw.metaKey=bw.ctrlKey}return bx.filter?bx.filter(bw,e):bw},special:{ready:{setup:b.bindReady},load:{noBubble:true},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(bw,bv,e){if(b.isWindow(this)){this.onbeforeunload=e}},teardown:function(bv,e){if(this.onbeforeunload===e){this.onbeforeunload=null}}}},simulate:function(bw,by,bx,bv){var bz=b.extend(new b.Event(),bx,{type:bw,isSimulated:true,originalEvent:{}});if(bv){b.event.trigger(bz,null,by)}else{b.event.dispatch.call(by,bz)}if(bz.isDefaultPrevented()){bx.preventDefault()}}};b.event.handle=b.event.dispatch;b.removeEvent=av.removeEventListener?function(bv,e,bw){if(bv.removeEventListener){bv.removeEventListener(e,bw,false)}}:function(bv,e,bw){if(bv.detachEvent){bv.detachEvent("on"+e,bw)}};b.Event=function(bv,e){if(!(this instanceof b.Event)){return new b.Event(bv,e)}if(bv&&bv.type){this.originalEvent=bv;this.type=bv.type;this.isDefaultPrevented=(bv.defaultPrevented||bv.returnValue===false||bv.getPreventDefault&&bv.getPreventDefault())?i:bk}else{this.type=bv}if(e){b.extend(this,e)}this.timeStamp=bv&&bv.timeStamp||b.now();this[b.expando]=true};function bk(){return false}function i(){return true}b.Event.prototype={preventDefault:function(){this.isDefaultPrevented=i;var bv=this.originalEvent;if(!bv){return}if(bv.preventDefault){bv.preventDefault()}else{bv.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=i;var bv=this.originalEvent;if(!bv){return}if(bv.stopPropagation){bv.stopPropagation()}bv.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=i;this.stopPropagation()},isDefaultPrevented:bk,isPropagationStopped:bk,isImmediatePropagationStopped:bk};b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(bv,e){b.event.special[bv]={delegateType:e,bindType:e,handle:function(bz){var bB=this,bA=bz.relatedTarget,by=bz.handleObj,bw=by.selector,bx;if(!bA||(bA!==bB&&!b.contains(bB,bA))){bz.type=by.origType;bx=by.handler.apply(this,arguments);bz.type=e}return bx}}});if(!b.support.submitBubbles){b.event.special.submit={setup:function(){if(b.nodeName(this,"form")){return false}b.event.add(this,"click._submit keypress._submit",function(bx){var bw=bx.target,bv=b.nodeName(bw,"input")||b.nodeName(bw,"button")?bw.form:L;if(bv&&!bv._submit_attached){b.event.add(bv,"submit._submit",function(e){if(this.parentNode&&!e.isTrigger){b.event.simulate("submit",this.parentNode,e,true)}});bv._submit_attached=true}})},teardown:function(){if(b.nodeName(this,"form")){return false}b.event.remove(this,"._submit")}}}if(!b.support.changeBubbles){b.event.special.change={setup:function(){if(bd.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio"){b.event.add(this,"propertychange._change",function(e){if(e.originalEvent.propertyName==="checked"){this._just_changed=true}});b.event.add(this,"click._change",function(e){if(this._just_changed&&!e.isTrigger){this._just_changed=false;b.event.simulate("change",this,e,true)}})}return false}b.event.add(this,"beforeactivate._change",function(bw){var bv=bw.target;if(bd.test(bv.nodeName)&&!bv._change_attached){b.event.add(bv,"change._change",function(e){if(this.parentNode&&!e.isSimulated&&!e.isTrigger){b.event.simulate("change",this.parentNode,e,true)}});bv._change_attached=true}})},handle:function(bv){var e=bv.target;if(this!==e||bv.isSimulated||bv.isTrigger||(e.type!=="radio"&&e.type!=="checkbox")){return bv.handleObj.handler.apply(this,arguments)}},teardown:function(){b.event.remove(this,"._change");return bd.test(this.nodeName)}}}if(!b.support.focusinBubbles){b.each({focus:"focusin",blur:"focusout"},function(bx,e){var bv=0,bw=function(by){b.event.simulate(e,by.target,b.event.fix(by),true)};b.event.special[e]={setup:function(){if(bv++===0){av.addEventListener(bx,bw,true)}},teardown:function(){if(--bv===0){av.removeEventListener(bx,bw,true)}}}})}b.fn.extend({on:function(bw,e,bz,by,bv){var bA,bx;if(typeof bw==="object"){if(typeof e!=="string"){bz=e;e=L}for(bx in bw){this.on(bx,e,bz,bw[bx],bv)}return this}if(bz==null&&by==null){by=e;bz=e=L}else{if(by==null){if(typeof e==="string"){by=bz;bz=L}else{by=bz;bz=e;e=L}}}if(by===false){by=bk}else{if(!by){return this}}if(bv===1){bA=by;by=function(bB){b().off(bB);return bA.apply(this,arguments)};by.guid=bA.guid||(bA.guid=b.guid++)}return this.each(function(){b.event.add(this,bw,by,bz,e)})},one:function(bv,e,bx,bw){return this.on.call(this,bv,e,bx,bw,1)},off:function(bw,e,by){if(bw&&bw.preventDefault&&bw.handleObj){var bv=bw.handleObj;b(bw.delegateTarget).off(bv.namespace?bv.type+"."+bv.namespace:bv.type,bv.selector,bv.handler);return this}if(typeof bw==="object"){for(var bx in bw){this.off(bx,e,bw[bx])}return this}if(e===false||typeof e==="function"){by=e;e=L}if(by===false){by=bk}return this.each(function(){b.event.remove(this,bw,by,e)})},bind:function(e,bw,bv){return this.on(e,null,bw,bv)},unbind:function(e,bv){return this.off(e,null,bv)},live:function(e,bw,bv){b(this.context).on(e,this.selector,bw,bv);return this},die:function(e,bv){b(this.context).off(e,this.selector||"**",bv);return this},delegate:function(e,bv,bx,bw){return this.on(bv,e,bx,bw)},undelegate:function(e,bv,bw){return arguments.length==1?this.off(e,"**"):this.off(bv,e,bw)},trigger:function(e,bv){return this.each(function(){b.event.trigger(e,bv,this)})},triggerHandler:function(e,bv){if(this[0]){return b.event.trigger(e,bv,this[0],true)}},toggle:function(bx){var bv=arguments,e=bx.guid||b.guid++,bw=0,by=function(bz){var bA=(b._data(this,"lastToggle"+bx.guid)||0)%bw;b._data(this,"lastToggle"+bx.guid,bA+1);bz.preventDefault();return bv[bA].apply(this,arguments)||false};by.guid=e;while(bw<bv.length){bv[bw++].guid=e}return this.click(by)},hover:function(e,bv){return this.mouseenter(e).mouseleave(bv||e)}});b.each(("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu").split(" "),function(bv,e){b.fn[e]=function(bx,bw){if(bw==null){bw=bx;bx=null}return arguments.length>0?this.on(e,null,bx,bw):this.trigger(e)};if(b.attrFn){b.attrFn[e]=true}if(aO.test(e)){b.event.fixHooks[e]=b.event.keyHooks}if(bf.test(e)){b.event.fixHooks[e]=b.event.mouseHooks}});
+/*!
+ * Sizzle CSS Selector Engine
+ *  Copyright 2011, The Dojo Foundation
+ *  Released under the MIT, BSD, and GPL Licenses.
+ *  More information: http://sizzlejs.com/
+ */
+(function(){var bH=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bC="sizcache"+(Math.random()+"").replace(".",""),bI=0,bL=Object.prototype.toString,bB=false,bA=true,bK=/\\/g,bO=/\r\n/g,bQ=/\W/;[0,0].sort(function(){bA=false;return 0});var by=function(bV,e,bY,bZ){bY=bY||[];e=e||av;var b1=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!bV||typeof bV!=="string"){return bY}var bS,b3,b6,bR,b2,b5,b4,bX,bU=true,bT=by.isXML(e),bW=[],b0=bV;do{bH.exec("");bS=bH.exec(b0);if(bS){b0=bS[3];bW.push(bS[1]);if(bS[2]){bR=bS[3];break}}}while(bS);if(bW.length>1&&bD.exec(bV)){if(bW.length===2&&bE.relative[bW[0]]){b3=bM(bW[0]+bW[1],e,bZ)}else{b3=bE.relative[bW[0]]?[e]:by(bW.shift(),e);while(bW.length){bV=bW.shift();if(bE.relative[bV]){bV+=bW.shift()}b3=bM(bV,b3,bZ)}}}else{if(!bZ&&bW.length>1&&e.nodeType===9&&!bT&&bE.match.ID.test(bW[0])&&!bE.match.ID.test(bW[bW.length-1])){b2=by.find(bW.shift(),e,bT);e=b2.expr?by.filter(b2.expr,b2.set)[0]:b2.set[0]}if(e){b2=bZ?{expr:bW.pop(),set:bF(bZ)}:by.find(bW.pop(),bW.length===1&&(bW[0]==="~"||bW[0]==="+")&&e.parentNode?e.parentNode:e,bT);b3=b2.expr?by.filter(b2.expr,b2.set):b2.set;if(bW.length>0){b6=bF(b3)}else{bU=false}while(bW.length){b5=bW.pop();b4=b5;if(!bE.relative[b5]){b5=""}else{b4=bW.pop()}if(b4==null){b4=e}bE.relative[b5](b6,b4,bT)}}else{b6=bW=[]}}if(!b6){b6=b3}if(!b6){by.error(b5||bV)}if(bL.call(b6)==="[object Array]"){if(!bU){bY.push.apply(bY,b6)}else{if(e&&e.nodeType===1){for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&(b6[bX]===true||b6[bX].nodeType===1&&by.contains(e,b6[bX]))){bY.push(b3[bX])}}}else{for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&b6[bX].nodeType===1){bY.push(b3[bX])}}}}}else{bF(b6,bY)}if(bR){by(bR,b1,bY,bZ);by.uniqueSort(bY)}return bY};by.uniqueSort=function(bR){if(bJ){bB=bA;bR.sort(bJ);if(bB){for(var e=1;e<bR.length;e++){if(bR[e]===bR[e-1]){bR.splice(e--,1)}}}}return bR};by.matches=function(e,bR){return by(e,null,null,bR)};by.matchesSelector=function(e,bR){return by(bR,null,null,[e]).length>0};by.find=function(bX,e,bY){var bW,bS,bU,bT,bV,bR;if(!bX){return[]}for(bS=0,bU=bE.order.length;bS<bU;bS++){bV=bE.order[bS];if((bT=bE.leftMatch[bV].exec(bX))){bR=bT[1];bT.splice(1,1);if(bR.substr(bR.length-1)!=="\\"){bT[1]=(bT[1]||"").replace(bK,"");bW=bE.find[bV](bT,e,bY);if(bW!=null){bX=bX.replace(bE.match[bV],"");break}}}}if(!bW){bW=typeof e.getElementsByTagName!=="undefined"?e.getElementsByTagName("*"):[]}return{set:bW,expr:bX}};by.filter=function(b1,b0,b4,bU){var bW,e,bZ,b6,b3,bR,bT,bV,b2,bS=b1,b5=[],bY=b0,bX=b0&&b0[0]&&by.isXML(b0[0]);while(b1&&b0.length){for(bZ in bE.filter){if((bW=bE.leftMatch[bZ].exec(b1))!=null&&bW[2]){bR=bE.filter[bZ];bT=bW[1];e=false;bW.splice(1,1);if(bT.substr(bT.length-1)==="\\"){continue}if(bY===b5){b5=[]}if(bE.preFilter[bZ]){bW=bE.preFilter[bZ](bW,bY,b4,b5,bU,bX);if(!bW){e=b6=true}else{if(bW===true){continue}}}if(bW){for(bV=0;(b3=bY[bV])!=null;bV++){if(b3){b6=bR(b3,bW,bV,bY);b2=bU^b6;if(b4&&b6!=null){if(b2){e=true}else{bY[bV]=false}}else{if(b2){b5.push(b3);e=true}}}}}if(b6!==L){if(!b4){bY=b5}b1=b1.replace(bE.match[bZ],"");if(!e){return[]}break}}}if(b1===bS){if(e==null){by.error(b1)}else{break}}bS=b1}return bY};by.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};var bw=by.getText=function(bU){var bS,bT,e=bU.nodeType,bR="";if(e){if(e===1||e===9){if(typeof bU.textContent==="string"){return bU.textContent}else{if(typeof bU.innerText==="string"){return bU.innerText.replace(bO,"")}else{for(bU=bU.firstChild;bU;bU=bU.nextSibling){bR+=bw(bU)}}}}else{if(e===3||e===4){return bU.nodeValue}}}else{for(bS=0;(bT=bU[bS]);bS++){if(bT.nodeType!==8){bR+=bw(bT)}}}return bR};var bE=by.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")},type:function(e){return e.getAttribute("type")}},relative:{"+":function(bW,bR){var bT=typeof bR==="string",bV=bT&&!bQ.test(bR),bX=bT&&!bV;if(bV){bR=bR.toLowerCase()}for(var bS=0,e=bW.length,bU;bS<e;bS++){if((bU=bW[bS])){while((bU=bU.previousSibling)&&bU.nodeType!==1){}bW[bS]=bX||bU&&bU.nodeName.toLowerCase()===bR?bU||false:bU===bR}}if(bX){by.filter(bR,bW,true)}},">":function(bW,bR){var bV,bU=typeof bR==="string",bS=0,e=bW.length;if(bU&&!bQ.test(bR)){bR=bR.toLowerCase();for(;bS<e;bS++){bV=bW[bS];if(bV){var bT=bV.parentNode;bW[bS]=bT.nodeName.toLowerCase()===bR?bT:false}}}else{for(;bS<e;bS++){bV=bW[bS];if(bV){bW[bS]=bU?bV.parentNode:bV.parentNode===bR}}if(bU){by.filter(bR,bW,true)}}},"":function(bT,bR,bV){var bU,bS=bI++,e=bN;if(typeof bR==="string"&&!bQ.test(bR)){bR=bR.toLowerCase();bU=bR;e=bv}e("parentNode",bR,bS,bT,bU,bV)},"~":function(bT,bR,bV){var bU,bS=bI++,e=bN;if(typeof bR==="string"&&!bQ.test(bR)){bR=bR.toLowerCase();bU=bR;e=bv}e("previousSibling",bR,bS,bT,bU,bV)}},find:{ID:function(bR,bS,bT){if(typeof bS.getElementById!=="undefined"&&!bT){var e=bS.getElementById(bR[1]);return e&&e.parentNode?[e]:[]}},NAME:function(bS,bV){if(typeof bV.getElementsByName!=="undefined"){var bR=[],bU=bV.getElementsByName(bS[1]);for(var bT=0,e=bU.length;bT<e;bT++){if(bU[bT].getAttribute("name")===bS[1]){bR.push(bU[bT])}}return bR.length===0?null:bR}},TAG:function(e,bR){if(typeof bR.getElementsByTagName!=="undefined"){return bR.getElementsByTagName(e[1])}}},preFilter:{CLASS:function(bT,bR,bS,e,bW,bX){bT=" "+bT[1].replace(bK,"")+" ";if(bX){return bT}for(var bU=0,bV;(bV=bR[bU])!=null;bU++){if(bV){if(bW^(bV.className&&(" "+bV.className+" ").replace(/[\t\n\r]/g," ").indexOf(bT)>=0)){if(!bS){e.push(bV)}}else{if(bS){bR[bU]=false}}}}return false},ID:function(e){return e[1].replace(bK,"")},TAG:function(bR,e){return bR[1].replace(bK,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){by.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var bR=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(bR[1]+(bR[2]||1))-0;e[3]=bR[3]-0}else{if(e[2]){by.error(e[0])}}e[0]=bI++;return e},ATTR:function(bU,bR,bS,e,bV,bW){var bT=bU[1]=bU[1].replace(bK,"");if(!bW&&bE.attrMap[bT]){bU[1]=bE.attrMap[bT]}bU[4]=(bU[4]||bU[5]||"").replace(bK,"");if(bU[2]==="~="){bU[4]=" "+bU[4]+" "}return bU},PSEUDO:function(bU,bR,bS,e,bV){if(bU[1]==="not"){if((bH.exec(bU[3])||"").length>1||/^\w/.test(bU[3])){bU[3]=by(bU[3],null,null,bR)}else{var bT=by.filter(bU[3],bR,bS,true^bV);if(!bS){e.push.apply(e,bT)}return false}}else{if(bE.match.POS.test(bU[0])||bE.match.CHILD.test(bU[0])){return true}}return bU},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(bS,bR,e){return !!by(e[3],bS).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(bS){var e=bS.getAttribute("type"),bR=bS.type;return bS.nodeName.toLowerCase()==="input"&&"text"===bR&&(e===bR||e===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"submit"===bR.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"reset"===bR.type},button:function(bR){var e=bR.nodeName.toLowerCase();return e==="input"&&"button"===bR.type||e==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(bR,e){return e===0},last:function(bS,bR,e,bT){return bR===bT.length-1},even:function(bR,e){return e%2===0},odd:function(bR,e){return e%2===1},lt:function(bS,bR,e){return bR<e[3]-0},gt:function(bS,bR,e){return bR>e[3]-0},nth:function(bS,bR,e){return e[3]-0===bR},eq:function(bS,bR,e){return e[3]-0===bR}},filter:{PSEUDO:function(bS,bX,bW,bY){var e=bX[1],bR=bE.filters[e];if(bR){return bR(bS,bW,bX,bY)}else{if(e==="contains"){return(bS.textContent||bS.innerText||bw([bS])||"").indexOf(bX[3])>=0}else{if(e==="not"){var bT=bX[3];for(var bV=0,bU=bT.length;bV<bU;bV++){if(bT[bV]===bS){return false}}return true}else{by.error(e)}}}},CHILD:function(bS,bU){var bT,b0,bW,bZ,e,bV,bY,bX=bU[1],bR=bS;switch(bX){case"only":case"first":while((bR=bR.previousSibling)){if(bR.nodeType===1){return false}}if(bX==="first"){return true}bR=bS;case"last":while((bR=bR.nextSibling)){if(bR.nodeType===1){return false}}return true;case"nth":bT=bU[2];b0=bU[3];if(bT===1&&b0===0){return true}bW=bU[0];bZ=bS.parentNode;if(bZ&&(bZ[bC]!==bW||!bS.nodeIndex)){bV=0;for(bR=bZ.firstChild;bR;bR=bR.nextSibling){if(bR.nodeType===1){bR.nodeIndex=++bV}}bZ[bC]=bW}bY=bS.nodeIndex-b0;if(bT===0){return bY===0}else{return(bY%bT===0&&bY/bT>=0)}}},ID:function(bR,e){return bR.nodeType===1&&bR.getAttribute("id")===e},TAG:function(bR,e){return(e==="*"&&bR.nodeType===1)||!!bR.nodeName&&bR.nodeName.toLowerCase()===e},CLASS:function(bR,e){return(" "+(bR.className||bR.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(bV,bT){var bS=bT[1],e=by.attr?by.attr(bV,bS):bE.attrHandle[bS]?bE.attrHandle[bS](bV):bV[bS]!=null?bV[bS]:bV.getAttribute(bS),bW=e+"",bU=bT[2],bR=bT[4];return e==null?bU==="!=":!bU&&by.attr?e!=null:bU==="="?bW===bR:bU==="*="?bW.indexOf(bR)>=0:bU==="~="?(" "+bW+" ").indexOf(bR)>=0:!bR?bW&&e!==false:bU==="!="?bW!==bR:bU==="^="?bW.indexOf(bR)===0:bU==="$="?bW.substr(bW.length-bR.length)===bR:bU==="|="?bW===bR||bW.substr(0,bR.length+1)===bR+"-":false},POS:function(bU,bR,bS,bV){var e=bR[2],bT=bE.setFilters[e];if(bT){return bT(bU,bS,bR,bV)}}}};var bD=bE.match.POS,bx=function(bR,e){return"\\"+(e-0+1)};for(var bz in bE.match){bE.match[bz]=new RegExp(bE.match[bz].source+(/(?![^\[]*\])(?![^\(]*\))/.source));bE.leftMatch[bz]=new RegExp(/(^(?:.|\r|\n)*?)/.source+bE.match[bz].source.replace(/\\(\d+)/g,bx))}var bF=function(bR,e){bR=Array.prototype.slice.call(bR,0);if(e){e.push.apply(e,bR);return e}return bR};try{Array.prototype.slice.call(av.documentElement.childNodes,0)[0].nodeType}catch(bP){bF=function(bU,bT){var bS=0,bR=bT||[];if(bL.call(bU)==="[object Array]"){Array.prototype.push.apply(bR,bU)}else{if(typeof bU.length==="number"){for(var e=bU.length;bS<e;bS++){bR.push(bU[bS])}}else{for(;bU[bS];bS++){bR.push(bU[bS])}}}return bR}}var bJ,bG;if(av.documentElement.compareDocumentPosition){bJ=function(bR,e){if(bR===e){bB=true;return 0}if(!bR.compareDocumentPosition||!e.compareDocumentPosition){return bR.compareDocumentPosition?-1:1}return bR.compareDocumentPosition(e)&4?-1:1}}else{bJ=function(bY,bX){if(bY===bX){bB=true;return 0}else{if(bY.sourceIndex&&bX.sourceIndex){return bY.sourceIndex-bX.sourceIndex}}var bV,bR,bS=[],e=[],bU=bY.parentNode,bW=bX.parentNode,bZ=bU;if(bU===bW){return bG(bY,bX)}else{if(!bU){return -1}else{if(!bW){return 1}}}while(bZ){bS.unshift(bZ);bZ=bZ.parentNode}bZ=bW;while(bZ){e.unshift(bZ);bZ=bZ.parentNode}bV=bS.length;bR=e.length;for(var bT=0;bT<bV&&bT<bR;bT++){if(bS[bT]!==e[bT]){return bG(bS[bT],e[bT])}}return bT===bV?bG(bY,e[bT],-1):bG(bS[bT],bX,1)};bG=function(bR,e,bS){if(bR===e){return bS}var bT=bR.nextSibling;while(bT){if(bT===e){return -1}bT=bT.nextSibling}return 1}}(function(){var bR=av.createElement("div"),bS="script"+(new Date()).getTime(),e=av.documentElement;bR.innerHTML="<a name='"+bS+"'/>";e.insertBefore(bR,e.firstChild);if(av.getElementById(bS)){bE.find.ID=function(bU,bV,bW){if(typeof bV.getElementById!=="undefined"&&!bW){var bT=bV.getElementById(bU[1]);return bT?bT.id===bU[1]||typeof bT.getAttributeNode!=="undefined"&&bT.getAttributeNode("id").nodeValue===bU[1]?[bT]:L:[]}};bE.filter.ID=function(bV,bT){var bU=typeof bV.getAttributeNode!=="undefined"&&bV.getAttributeNode("id");return bV.nodeType===1&&bU&&bU.nodeValue===bT}}e.removeChild(bR);e=bR=null})();(function(){var e=av.createElement("div");e.appendChild(av.createComment(""));if(e.getElementsByTagName("*").length>0){bE.find.TAG=function(bR,bV){var bU=bV.getElementsByTagName(bR[1]);if(bR[1]==="*"){var bT=[];for(var bS=0;bU[bS];bS++){if(bU[bS].nodeType===1){bT.push(bU[bS])}}bU=bT}return bU}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){bE.attrHandle.href=function(bR){return bR.getAttribute("href",2)}}e=null})();if(av.querySelectorAll){(function(){var e=by,bT=av.createElement("div"),bS="__sizzle__";bT.innerHTML="<p class='TEST'></p>";if(bT.querySelectorAll&&bT.querySelectorAll(".TEST").length===0){return}by=function(b4,bV,bZ,b3){bV=bV||av;if(!b3&&!by.isXML(bV)){var b2=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b4);if(b2&&(bV.nodeType===1||bV.nodeType===9)){if(b2[1]){return bF(bV.getElementsByTagName(b4),bZ)}else{if(b2[2]&&bE.find.CLASS&&bV.getElementsByClassName){return bF(bV.getElementsByClassName(b2[2]),bZ)}}}if(bV.nodeType===9){if(b4==="body"&&bV.body){return bF([bV.body],bZ)}else{if(b2&&b2[3]){var bY=bV.getElementById(b2[3]);if(bY&&bY.parentNode){if(bY.id===b2[3]){return bF([bY],bZ)}}else{return bF([],bZ)}}}try{return bF(bV.querySelectorAll(b4),bZ)}catch(b0){}}else{if(bV.nodeType===1&&bV.nodeName.toLowerCase()!=="object"){var bW=bV,bX=bV.getAttribute("id"),bU=bX||bS,b6=bV.parentNode,b5=/^\s*[+~]/.test(b4);if(!bX){bV.setAttribute("id",bU)}else{bU=bU.replace(/'/g,"\\$&")}if(b5&&b6){bV=bV.parentNode}try{if(!b5||b6){return bF(bV.querySelectorAll("[id='"+bU+"'] "+b4),bZ)}}catch(b1){}finally{if(!bX){bW.removeAttribute("id")}}}}}return e(b4,bV,bZ,b3)};for(var bR in e){by[bR]=e[bR]}bT=null})()}(function(){var e=av.documentElement,bS=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(bS){var bU=!bS.call(av.createElement("div"),"div"),bR=false;try{bS.call(av.documentElement,"[test!='']:sizzle")}catch(bT){bR=true}by.matchesSelector=function(bW,bY){bY=bY.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!by.isXML(bW)){try{if(bR||!bE.match.PSEUDO.test(bY)&&!/!=/.test(bY)){var bV=bS.call(bW,bY);if(bV||!bU||bW.document&&bW.document.nodeType!==11){return bV}}}catch(bX){}}return by(bY,null,null,[bW]).length>0}}})();(function(){var e=av.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}bE.order.splice(1,0,"CLASS");bE.find.CLASS=function(bR,bS,bT){if(typeof bS.getElementsByClassName!=="undefined"&&!bT){return bS.getElementsByClassName(bR[1])}};e=null})();function bv(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT<bS;bT++){var e=bZ[bT];if(e){var bU=false;e=e[bR];while(e){if(e[bC]===bV){bU=bZ[e.sizset];break}if(e.nodeType===1&&!bY){e[bC]=bV;e.sizset=bT}if(e.nodeName.toLowerCase()===bW){bU=e;break}e=e[bR]}bZ[bT]=bU}}}function bN(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT<bS;bT++){var e=bZ[bT];if(e){var bU=false;e=e[bR];while(e){if(e[bC]===bV){bU=bZ[e.sizset];break}if(e.nodeType===1){if(!bY){e[bC]=bV;e.sizset=bT}if(typeof bW!=="string"){if(e===bW){bU=true;break}}else{if(by.filter(bW,[e]).length>0){bU=e;break}}}e=e[bR]}bZ[bT]=bU}}}if(av.documentElement.contains){by.contains=function(bR,e){return bR!==e&&(bR.contains?bR.contains(e):true)}}else{if(av.documentElement.compareDocumentPosition){by.contains=function(bR,e){return !!(bR.compareDocumentPosition(e)&16)}}else{by.contains=function(){return false}}}by.isXML=function(e){var bR=(e?e.ownerDocument||e:0).documentElement;return bR?bR.nodeName!=="HTML":false};var bM=function(bS,e,bW){var bV,bX=[],bU="",bY=e.nodeType?[e]:e;while((bV=bE.match.PSEUDO.exec(bS))){bU+=bV[0];bS=bS.replace(bE.match.PSEUDO,"")}bS=bE.relative[bS]?bS+"*":bS;for(var bT=0,bR=bY.length;bT<bR;bT++){by(bS,bY[bT],bX,bW)}return by.filter(bU,bX)};by.attr=b.attr;by.selectors.attrMap={};b.find=by;b.expr=by.selectors;b.expr[":"]=b.expr.filters;b.unique=by.uniqueSort;b.text=by.getText;b.isXMLDoc=by.isXML;b.contains=by.contains})();var ab=/Until$/,aq=/^(?:parents|prevUntil|prevAll)/,a9=/,/,bp=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,H=b.expr.match.POS,ay={children:true,contents:true,next:true,prev:true};b.fn.extend({find:function(e){var bw=this,by,bv;if(typeof e!=="string"){return b(e).filter(function(){for(by=0,bv=bw.length;by<bv;by++){if(b.contains(bw[by],this)){return true}}})}var bx=this.pushStack("","find",e),bA,bB,bz;for(by=0,bv=this.length;by<bv;by++){bA=bx.length;b.find(e,this[by],bx);if(by>0){for(bB=bA;bB<bx.length;bB++){for(bz=0;bz<bA;bz++){if(bx[bz]===bx[bB]){bx.splice(bB--,1);break}}}}}return bx},has:function(bv){var e=b(bv);return this.filter(function(){for(var bx=0,bw=e.length;bx<bw;bx++){if(b.contains(this,e[bx])){return true}}})},not:function(e){return this.pushStack(aG(this,e,false),"not",e)},filter:function(e){return this.pushStack(aG(this,e,true),"filter",e)},is:function(e){return !!e&&(typeof e==="string"?H.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(by,bx){var bv=[],bw,e,bz=this[0];if(b.isArray(by)){var bB=1;while(bz&&bz.ownerDocument&&bz!==bx){for(bw=0;bw<by.length;bw++){if(b(bz).is(by[bw])){bv.push({selector:by[bw],elem:bz,level:bB})}}bz=bz.parentNode;bB++}return bv}var bA=H.test(by)||typeof by!=="string"?b(by,bx||this.context):0;for(bw=0,e=this.length;bw<e;bw++){bz=this[bw];while(bz){if(bA?bA.index(bz)>-1:b.find.matchesSelector(bz,by)){bv.push(bz);break}else{bz=bz.parentNode;if(!bz||!bz.ownerDocument||bz===bx||bz.nodeType===11){break}}}}bv=bv.length>1?b.unique(bv):bv;return this.pushStack(bv,"closest",by)},index:function(e){if(!e){return(this[0]&&this[0].parentNode)?this.prevAll().length:-1}if(typeof e==="string"){return b.inArray(this[0],b(e))}return b.inArray(e.jquery?e[0]:e,this)},add:function(e,bv){var bx=typeof e==="string"?b(e,bv):b.makeArray(e&&e.nodeType?[e]:e),bw=b.merge(this.get(),bx);return this.pushStack(C(bx[0])||C(bw[0])?bw:b.unique(bw))},andSelf:function(){return this.add(this.prevObject)}});function C(e){return !e||!e.parentNode||e.parentNode.nodeType===11}b.each({parent:function(bv){var e=bv.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(bv,e,bw){return b.dir(bv,"parentNode",bw)},next:function(e){return b.nth(e,2,"nextSibling")},prev:function(e){return b.nth(e,2,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(bv,e,bw){return b.dir(bv,"nextSibling",bw)},prevUntil:function(bv,e,bw){return b.dir(bv,"previousSibling",bw)},siblings:function(e){return b.sibling(e.parentNode.firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.makeArray(e.childNodes)}},function(e,bv){b.fn[e]=function(by,bw){var bx=b.map(this,bv,by);if(!ab.test(e)){bw=by}if(bw&&typeof bw==="string"){bx=b.filter(bw,bx)}bx=this.length>1&&!ay[e]?b.unique(bx):bx;if((this.length>1||a9.test(bw))&&aq.test(e)){bx=bx.reverse()}return this.pushStack(bx,e,P.call(arguments).join(","))}});b.extend({filter:function(bw,e,bv){if(bv){bw=":not("+bw+")"}return e.length===1?b.find.matchesSelector(e[0],bw)?[e[0]]:[]:b.find.matches(bw,e)},dir:function(bw,bv,by){var e=[],bx=bw[bv];while(bx&&bx.nodeType!==9&&(by===L||bx.nodeType!==1||!b(bx).is(by))){if(bx.nodeType===1){e.push(bx)}bx=bx[bv]}return e},nth:function(by,e,bw,bx){e=e||1;var bv=0;for(;by;by=by[bw]){if(by.nodeType===1&&++bv===e){break}}return by},sibling:function(bw,bv){var e=[];for(;bw;bw=bw.nextSibling){if(bw.nodeType===1&&bw!==bv){e.push(bw)}}return e}});function aG(bx,bw,e){bw=bw||0;if(b.isFunction(bw)){return b.grep(bx,function(bz,by){var bA=!!bw.call(bz,by,bz);return bA===e})}else{if(bw.nodeType){return b.grep(bx,function(bz,by){return(bz===bw)===e})}else{if(typeof bw==="string"){var bv=b.grep(bx,function(by){return by.nodeType===1});if(bp.test(bw)){return b.filter(bw,bv,!e)}else{bw=b.filter(bw,bv)}}}}return b.grep(bx,function(bz,by){return(b.inArray(bz,bw)>=0)===e})}function a(e){var bw=aR.split("|"),bv=e.createDocumentFragment();if(bv.createElement){while(bw.length){bv.createElement(bw.pop())}}return bv}var aR="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ag=/ jQuery\d+="(?:\d+|null)"/g,ar=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,d=/<([\w:]+)/,w=/<tbody/i,W=/<|&#?\w+;/,ae=/<(?:script|style)/i,O=/<(?:script|object|embed|option|style)/i,ah=new RegExp("<(?:"+aR+")","i"),o=/checked\s*(?:[^=]|=\s*.checked.)/i,bm=/\/(java|ecma)script/i,aN=/^\s*<!(?:\[CDATA\[|\-\-)/,ax={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},ac=a(av);ax.optgroup=ax.option;ax.tbody=ax.tfoot=ax.colgroup=ax.caption=ax.thead;ax.th=ax.td;if(!b.support.htmlSerialize){ax._default=[1,"div<div>","</div>"]}b.fn.extend({text:function(e){if(b.isFunction(e)){return this.each(function(bw){var bv=b(this);bv.text(e.call(this,bw,bv.text()))})}if(typeof e!=="object"&&e!==L){return this.empty().append((this[0]&&this[0].ownerDocument||av).createTextNode(e))}return b.text(this)},wrapAll:function(e){if(b.isFunction(e)){return this.each(function(bw){b(this).wrapAll(e.call(this,bw))})}if(this[0]){var bv=b(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){bv.insertBefore(this[0])}bv.map(function(){var bw=this;while(bw.firstChild&&bw.firstChild.nodeType===1){bw=bw.firstChild}return bw}).append(this)}return this},wrapInner:function(e){if(b.isFunction(e)){return this.each(function(bv){b(this).wrapInner(e.call(this,bv))})}return this.each(function(){var bv=b(this),bw=bv.contents();if(bw.length){bw.wrapAll(e)}else{bv.append(e)}})},wrap:function(e){var bv=b.isFunction(e);return this.each(function(bw){b(this).wrapAll(bv?e.call(this,bw):e)})},unwrap:function(){return this.parent().each(function(){if(!b.nodeName(this,"body")){b(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.appendChild(e)}})},prepend:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.insertBefore(e,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this)})}else{if(arguments.length){var e=b.clean(arguments);e.push.apply(e,this.toArray());return this.pushStack(e,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this.nextSibling)})}else{if(arguments.length){var e=this.pushStack(this,"after",arguments);e.push.apply(e,b.clean(arguments));return e}}},remove:function(e,bx){for(var bv=0,bw;(bw=this[bv])!=null;bv++){if(!e||b.filter(e,[bw]).length){if(!bx&&bw.nodeType===1){b.cleanData(bw.getElementsByTagName("*"));b.cleanData([bw])}if(bw.parentNode){bw.parentNode.removeChild(bw)}}}return this},empty:function(){for(var e=0,bv;(bv=this[e])!=null;e++){if(bv.nodeType===1){b.cleanData(bv.getElementsByTagName("*"))}while(bv.firstChild){bv.removeChild(bv.firstChild)}}return this},clone:function(bv,e){bv=bv==null?false:bv;e=e==null?bv:e;return this.map(function(){return b.clone(this,bv,e)})},html:function(bx){if(bx===L){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ag,""):null}else{if(typeof bx==="string"&&!ae.test(bx)&&(b.support.leadingWhitespace||!ar.test(bx))&&!ax[(d.exec(bx)||["",""])[1].toLowerCase()]){bx=bx.replace(R,"<$1></$2>");try{for(var bw=0,bv=this.length;bw<bv;bw++){if(this[bw].nodeType===1){b.cleanData(this[bw].getElementsByTagName("*"));this[bw].innerHTML=bx}}}catch(by){this.empty().append(bx)}}else{if(b.isFunction(bx)){this.each(function(bz){var e=b(this);e.html(bx.call(this,bz,e.html()))})}else{this.empty().append(bx)}}}return this},replaceWith:function(e){if(this[0]&&this[0].parentNode){if(b.isFunction(e)){return this.each(function(bx){var bw=b(this),bv=bw.html();bw.replaceWith(e.call(this,bx,bv))})}if(typeof e!=="string"){e=b(e).detach()}return this.each(function(){var bw=this.nextSibling,bv=this.parentNode;b(this).remove();if(bw){b(bw).before(e)}else{b(bv).append(e)}})}else{return this.length?this.pushStack(b(b.isFunction(e)?e():e),"replaceWith",e):this}},detach:function(e){return this.remove(e,true)},domManip:function(bB,bF,bE){var bx,by,bA,bD,bC=bB[0],bv=[];if(!b.support.checkClone&&arguments.length===3&&typeof bC==="string"&&o.test(bC)){return this.each(function(){b(this).domManip(bB,bF,bE,true)})}if(b.isFunction(bC)){return this.each(function(bH){var bG=b(this);bB[0]=bC.call(this,bH,bF?bG.html():L);bG.domManip(bB,bF,bE)})}if(this[0]){bD=bC&&bC.parentNode;if(b.support.parentNode&&bD&&bD.nodeType===11&&bD.childNodes.length===this.length){bx={fragment:bD}}else{bx=b.buildFragment(bB,this,bv)}bA=bx.fragment;if(bA.childNodes.length===1){by=bA=bA.firstChild}else{by=bA.firstChild}if(by){bF=bF&&b.nodeName(by,"tr");for(var bw=0,e=this.length,bz=e-1;bw<e;bw++){bE.call(bF?ba(this[bw],by):this[bw],bx.cacheable||(e>1&&bw<bz)?b.clone(bA,true,true):bA)}}if(bv.length){b.each(bv,bo)}}return this}});function ba(e,bv){return b.nodeName(e,"table")?(e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody"))):e}function t(bB,bv){if(bv.nodeType!==1||!b.hasData(bB)){return}var by,bx,e,bA=b._data(bB),bz=b._data(bv,bA),bw=bA.events;if(bw){delete bz.handle;bz.events={};for(by in bw){for(bx=0,e=bw[by].length;bx<e;bx++){b.event.add(bv,by+(bw[by][bx].namespace?".":"")+bw[by][bx].namespace,bw[by][bx],bw[by][bx].data)}}}if(bz.data){bz.data=b.extend({},bz.data)}}function ai(bv,e){var bw;if(e.nodeType!==1){return}if(e.clearAttributes){e.clearAttributes()}if(e.mergeAttributes){e.mergeAttributes(bv)}bw=e.nodeName.toLowerCase();if(bw==="object"){e.outerHTML=bv.outerHTML}else{if(bw==="input"&&(bv.type==="checkbox"||bv.type==="radio")){if(bv.checked){e.defaultChecked=e.checked=bv.checked}if(e.value!==bv.value){e.value=bv.value}}else{if(bw==="option"){e.selected=bv.defaultSelected}else{if(bw==="input"||bw==="textarea"){e.defaultValue=bv.defaultValue}}}}e.removeAttribute(b.expando)}b.buildFragment=function(bz,bx,bv){var by,e,bw,bA,bB=bz[0];if(bx&&bx[0]){bA=bx[0].ownerDocument||bx[0]}if(!bA.createDocumentFragment){bA=av}if(bz.length===1&&typeof bB==="string"&&bB.length<512&&bA===av&&bB.charAt(0)==="<"&&!O.test(bB)&&(b.support.checkClone||!o.test(bB))&&(b.support.html5Clone||!ah.test(bB))){e=true;bw=b.fragments[bB];if(bw&&bw!==1){by=bw}}if(!by){by=bA.createDocumentFragment();b.clean(bz,bA,by,bv)}if(e){b.fragments[bB]=bw?by:1}return{fragment:by,cacheable:e}};b.fragments={};b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,bv){b.fn[e]=function(bw){var bz=[],bC=b(bw),bB=this.length===1&&this[0].parentNode;if(bB&&bB.nodeType===11&&bB.childNodes.length===1&&bC.length===1){bC[bv](this[0]);return this}else{for(var bA=0,bx=bC.length;bA<bx;bA++){var by=(bA>0?this.clone(true):this).get();b(bC[bA])[bv](by);bz=bz.concat(by)}return this.pushStack(bz,e,bC.selector)}}});function bg(e){if(typeof e.getElementsByTagName!=="undefined"){return e.getElementsByTagName("*")}else{if(typeof e.querySelectorAll!=="undefined"){return e.querySelectorAll("*")}else{return[]}}}function az(e){if(e.type==="checkbox"||e.type==="radio"){e.defaultChecked=e.checked}}function E(e){var bv=(e.nodeName||"").toLowerCase();if(bv==="input"){az(e)}else{if(bv!=="script"&&typeof e.getElementsByTagName!=="undefined"){b.grep(e.getElementsByTagName("input"),az)}}}function al(e){var bv=av.createElement("div");ac.appendChild(bv);bv.innerHTML=e.outerHTML;return bv.firstChild}b.extend({clone:function(by,bA,bw){var e,bv,bx,bz=b.support.html5Clone||!ah.test("<"+by.nodeName)?by.cloneNode(true):al(by);if((!b.support.noCloneEvent||!b.support.noCloneChecked)&&(by.nodeType===1||by.nodeType===11)&&!b.isXMLDoc(by)){ai(by,bz);e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){if(bv[bx]){ai(e[bx],bv[bx])}}}if(bA){t(by,bz);if(bw){e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){t(e[bx],bv[bx])}}}e=bv=null;return bz},clean:function(bw,by,bH,bA){var bF;by=by||av;if(typeof by.createElement==="undefined"){by=by.ownerDocument||by[0]&&by[0].ownerDocument||av}var bI=[],bB;for(var bE=0,bz;(bz=bw[bE])!=null;bE++){if(typeof bz==="number"){bz+=""}if(!bz){continue}if(typeof bz==="string"){if(!W.test(bz)){bz=by.createTextNode(bz)}else{bz=bz.replace(R,"<$1></$2>");var bK=(d.exec(bz)||["",""])[1].toLowerCase(),bx=ax[bK]||ax._default,bD=bx[0],bv=by.createElement("div");if(by===av){ac.appendChild(bv)}else{a(by).appendChild(bv)}bv.innerHTML=bx[1]+bz+bx[2];while(bD--){bv=bv.lastChild}if(!b.support.tbody){var e=w.test(bz),bC=bK==="table"&&!e?bv.firstChild&&bv.firstChild.childNodes:bx[1]==="<table>"&&!e?bv.childNodes:[];for(bB=bC.length-1;bB>=0;--bB){if(b.nodeName(bC[bB],"tbody")&&!bC[bB].childNodes.length){bC[bB].parentNode.removeChild(bC[bB])}}}if(!b.support.leadingWhitespace&&ar.test(bz)){bv.insertBefore(by.createTextNode(ar.exec(bz)[0]),bv.firstChild)}bz=bv.childNodes}}var bG;if(!b.support.appendChecked){if(bz[0]&&typeof(bG=bz.length)==="number"){for(bB=0;bB<bG;bB++){E(bz[bB])}}else{E(bz)}}if(bz.nodeType){bI.push(bz)}else{bI=b.merge(bI,bz)}}if(bH){bF=function(bL){return !bL.type||bm.test(bL.type)};for(bE=0;bI[bE];bE++){if(bA&&b.nodeName(bI[bE],"script")&&(!bI[bE].type||bI[bE].type.toLowerCase()==="text/javascript")){bA.push(bI[bE].parentNode?bI[bE].parentNode.removeChild(bI[bE]):bI[bE])}else{if(bI[bE].nodeType===1){var bJ=b.grep(bI[bE].getElementsByTagName("script"),bF);bI.splice.apply(bI,[bE+1,0].concat(bJ))}bH.appendChild(bI[bE])}}}return bI},cleanData:function(bv){var by,bw,e=b.cache,bB=b.event.special,bA=b.support.deleteExpando;for(var bz=0,bx;(bx=bv[bz])!=null;bz++){if(bx.nodeName&&b.noData[bx.nodeName.toLowerCase()]){continue}bw=bx[b.expando];if(bw){by=e[bw];if(by&&by.events){for(var bC in by.events){if(bB[bC]){b.event.remove(bx,bC)}else{b.removeEvent(bx,bC,by.handle)}}if(by.handle){by.handle.elem=null}}if(bA){delete bx[b.expando]}else{if(bx.removeAttribute){bx.removeAttribute(b.expando)}}delete e[bw]}}}});function bo(e,bv){if(bv.src){b.ajax({url:bv.src,async:false,dataType:"script"})}else{b.globalEval((bv.text||bv.textContent||bv.innerHTML||"").replace(aN,"/*$0*/"))}if(bv.parentNode){bv.parentNode.removeChild(bv)}}var ak=/alpha\([^)]*\)/i,au=/opacity=([^)]*)/,z=/([A-Z]|^ms)/g,bc=/^-?\d+(?:px)?$/i,bn=/^-?\d/,I=/^([\-+])=([\-+.\de]+)/,a7={position:"absolute",visibility:"hidden",display:"block"},an=["Left","Right"],a1=["Top","Bottom"],Z,aI,aX;b.fn.css=function(e,bv){if(arguments.length===2&&bv===L){return this}return b.access(this,e,bv,true,function(bx,bw,by){return by!==L?b.style(bx,bw,by):b.css(bx,bw)})};b.extend({cssHooks:{opacity:{get:function(bw,bv){if(bv){var e=Z(bw,"opacity","opacity");return e===""?"1":e}else{return bw.style.opacity}}}},cssNumber:{fillOpacity:true,fontWeight:true,lineHeight:true,opacity:true,orphans:true,widows:true,zIndex:true,zoom:true},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(bx,bw,bD,by){if(!bx||bx.nodeType===3||bx.nodeType===8||!bx.style){return}var bB,bC,bz=b.camelCase(bw),bv=bx.style,bE=b.cssHooks[bz];bw=b.cssProps[bz]||bz;if(bD!==L){bC=typeof bD;if(bC==="string"&&(bB=I.exec(bD))){bD=(+(bB[1]+1)*+bB[2])+parseFloat(b.css(bx,bw));bC="number"}if(bD==null||bC==="number"&&isNaN(bD)){return}if(bC==="number"&&!b.cssNumber[bz]){bD+="px"}if(!bE||!("set" in bE)||(bD=bE.set(bx,bD))!==L){try{bv[bw]=bD}catch(bA){}}}else{if(bE&&"get" in bE&&(bB=bE.get(bx,false,by))!==L){return bB}return bv[bw]}},css:function(by,bx,bv){var bw,e;bx=b.camelCase(bx);e=b.cssHooks[bx];bx=b.cssProps[bx]||bx;if(bx==="cssFloat"){bx="float"}if(e&&"get" in e&&(bw=e.get(by,true,bv))!==L){return bw}else{if(Z){return Z(by,bx)}}},swap:function(bx,bw,by){var e={};for(var bv in bw){e[bv]=bx.style[bv];bx.style[bv]=bw[bv]}by.call(bx);for(bv in bw){bx.style[bv]=e[bv]}}});b.curCSS=b.css;b.each(["height","width"],function(bv,e){b.cssHooks[e]={get:function(by,bx,bw){var bz;if(bx){if(by.offsetWidth!==0){return p(by,e,bw)}else{b.swap(by,a7,function(){bz=p(by,e,bw)})}return bz}},set:function(bw,bx){if(bc.test(bx)){bx=parseFloat(bx);if(bx>=0){return bx+"px"}}else{return bx}}}});if(!b.support.opacity){b.cssHooks.opacity={get:function(bv,e){return au.test((e&&bv.currentStyle?bv.currentStyle.filter:bv.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":e?"1":""},set:function(by,bz){var bx=by.style,bv=by.currentStyle,e=b.isNumeric(bz)?"alpha(opacity="+bz*100+")":"",bw=bv&&bv.filter||bx.filter||"";bx.zoom=1;if(bz>=1&&b.trim(bw.replace(ak,""))===""){bx.removeAttribute("filter");if(bv&&!bv.filter){return}}bx.filter=ak.test(bw)?bw.replace(ak,e):bw+" "+e}}}b(function(){if(!b.support.reliableMarginRight){b.cssHooks.marginRight={get:function(bw,bv){var e;b.swap(bw,{display:"inline-block"},function(){if(bv){e=Z(bw,"margin-right","marginRight")}else{e=bw.style.marginRight}});return e}}}});if(av.defaultView&&av.defaultView.getComputedStyle){aI=function(by,bw){var bv,bx,e;bw=bw.replace(z,"-$1").toLowerCase();if((bx=by.ownerDocument.defaultView)&&(e=bx.getComputedStyle(by,null))){bv=e.getPropertyValue(bw);if(bv===""&&!b.contains(by.ownerDocument.documentElement,by)){bv=b.style(by,bw)}}return bv}}if(av.documentElement.currentStyle){aX=function(bz,bw){var bA,e,by,bv=bz.currentStyle&&bz.currentStyle[bw],bx=bz.style;if(bv===null&&bx&&(by=bx[bw])){bv=by}if(!bc.test(bv)&&bn.test(bv)){bA=bx.left;e=bz.runtimeStyle&&bz.runtimeStyle.left;if(e){bz.runtimeStyle.left=bz.currentStyle.left}bx.left=bw==="fontSize"?"1em":(bv||0);bv=bx.pixelLeft+"px";bx.left=bA;if(e){bz.runtimeStyle.left=e}}return bv===""?"auto":bv}}Z=aI||aX;function p(by,bw,bv){var bA=bw==="width"?by.offsetWidth:by.offsetHeight,bz=bw==="width"?an:a1,bx=0,e=bz.length;if(bA>0){if(bv!=="border"){for(;bx<e;bx++){if(!bv){bA-=parseFloat(b.css(by,"padding"+bz[bx]))||0}if(bv==="margin"){bA+=parseFloat(b.css(by,bv+bz[bx]))||0}else{bA-=parseFloat(b.css(by,"border"+bz[bx]+"Width"))||0}}}return bA+"px"}bA=Z(by,bw,bw);if(bA<0||bA==null){bA=by.style[bw]||0}bA=parseFloat(bA)||0;if(bv){for(;bx<e;bx++){bA+=parseFloat(b.css(by,"padding"+bz[bx]))||0;if(bv!=="padding"){bA+=parseFloat(b.css(by,"border"+bz[bx]+"Width"))||0}if(bv==="margin"){bA+=parseFloat(b.css(by,bv+bz[bx]))||0}}}return bA+"px"}if(b.expr&&b.expr.filters){b.expr.filters.hidden=function(bw){var bv=bw.offsetWidth,e=bw.offsetHeight;return(bv===0&&e===0)||(!b.support.reliableHiddenOffsets&&((bw.style&&bw.style.display)||b.css(bw,"display"))==="none")};b.expr.filters.visible=function(e){return !b.expr.filters.hidden(e)}}var k=/%20/g,ap=/\[\]$/,bs=/\r?\n/g,bq=/#.*$/,aD=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,aZ=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,aM=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,aQ=/^(?:GET|HEAD)$/,c=/^\/\//,M=/\?/,a6=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,q=/^(?:select|textarea)/i,h=/\s+/,br=/([?&])_=[^&]*/,K=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,A=b.fn.load,aa={},r={},aE,s,aV=["*/"]+["*"];try{aE=bl.href}catch(aw){aE=av.createElement("a");aE.href="";aE=aE.href}s=K.exec(aE.toLowerCase())||[];function f(e){return function(by,bA){if(typeof by!=="string"){bA=by;by="*"}if(b.isFunction(bA)){var bx=by.toLowerCase().split(h),bw=0,bz=bx.length,bv,bB,bC;for(;bw<bz;bw++){bv=bx[bw];bC=/^\+/.test(bv);if(bC){bv=bv.substr(1)||"*"}bB=e[bv]=e[bv]||[];bB[bC?"unshift":"push"](bA)}}}}function aW(bv,bE,bz,bD,bB,bx){bB=bB||bE.dataTypes[0];bx=bx||{};bx[bB]=true;var bA=bv[bB],bw=0,e=bA?bA.length:0,by=(bv===aa),bC;for(;bw<e&&(by||!bC);bw++){bC=bA[bw](bE,bz,bD);if(typeof bC==="string"){if(!by||bx[bC]){bC=L}else{bE.dataTypes.unshift(bC);bC=aW(bv,bE,bz,bD,bC,bx)}}}if((by||!bC)&&!bx["*"]){bC=aW(bv,bE,bz,bD,"*",bx)}return bC}function am(bw,bx){var bv,e,by=b.ajaxSettings.flatOptions||{};for(bv in bx){if(bx[bv]!==L){(by[bv]?bw:(e||(e={})))[bv]=bx[bv]}}if(e){b.extend(true,bw,e)}}b.fn.extend({load:function(bw,bz,bA){if(typeof bw!=="string"&&A){return A.apply(this,arguments)}else{if(!this.length){return this}}var by=bw.indexOf(" ");if(by>=0){var e=bw.slice(by,bw.length);bw=bw.slice(0,by)}var bx="GET";if(bz){if(b.isFunction(bz)){bA=bz;bz=L}else{if(typeof bz==="object"){bz=b.param(bz,b.ajaxSettings.traditional);bx="POST"}}}var bv=this;b.ajax({url:bw,type:bx,dataType:"html",data:bz,complete:function(bC,bB,bD){bD=bC.responseText;if(bC.isResolved()){bC.done(function(bE){bD=bE});bv.html(e?b("<div>").append(bD.replace(a6,"")).find(e):bD)}if(bA){bv.each(bA,[bD,bB,bC])}}});return this},serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?b.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||q.test(this.nodeName)||aZ.test(this.type))}).map(function(e,bv){var bw=b(this).val();return bw==null?null:b.isArray(bw)?b.map(bw,function(by,bx){return{name:bv.name,value:by.replace(bs,"\r\n")}}):{name:bv.name,value:bw.replace(bs,"\r\n")}}).get()}});b.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,bv){b.fn[bv]=function(bw){return this.on(bv,bw)}});b.each(["get","post"],function(e,bv){b[bv]=function(bw,by,bz,bx){if(b.isFunction(by)){bx=bx||bz;bz=by;by=L}return b.ajax({type:bv,url:bw,data:by,success:bz,dataType:bx})}});b.extend({getScript:function(e,bv){return b.get(e,L,bv,"script")},getJSON:function(e,bv,bw){return b.get(e,bv,bw,"json")},ajaxSetup:function(bv,e){if(e){am(bv,b.ajaxSettings)}else{e=bv;bv=b.ajaxSettings}am(bv,e);return bv},ajaxSettings:{url:aE,isLocal:aM.test(s[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":aV},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":bb.String,"text html":true,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{context:true,url:true}},ajaxPrefilter:f(aa),ajaxTransport:f(r),ajax:function(bz,bx){if(typeof bz==="object"){bx=bz;bz=L}bx=bx||{};var bD=b.ajaxSetup({},bx),bS=bD.context||bD,bG=bS!==bD&&(bS.nodeType||bS instanceof b)?b(bS):b.event,bR=b.Deferred(),bN=b.Callbacks("once memory"),bB=bD.statusCode||{},bC,bH={},bO={},bQ,by,bL,bE,bI,bA=0,bw,bK,bJ={readyState:0,setRequestHeader:function(bT,bU){if(!bA){var e=bT.toLowerCase();bT=bO[e]=bO[e]||bT;bH[bT]=bU}return this},getAllResponseHeaders:function(){return bA===2?bQ:null},getResponseHeader:function(bT){var e;if(bA===2){if(!by){by={};while((e=aD.exec(bQ))){by[e[1].toLowerCase()]=e[2]}}e=by[bT.toLowerCase()]}return e===L?null:e},overrideMimeType:function(e){if(!bA){bD.mimeType=e}return this},abort:function(e){e=e||"abort";if(bL){bL.abort(e)}bF(0,e);return this}};function bF(bZ,bU,b0,bW){if(bA===2){return}bA=2;if(bE){clearTimeout(bE)}bL=L;bQ=bW||"";bJ.readyState=bZ>0?4:0;var bT,b4,b3,bX=bU,bY=b0?bj(bD,bJ,b0):L,bV,b2;if(bZ>=200&&bZ<300||bZ===304){if(bD.ifModified){if((bV=bJ.getResponseHeader("Last-Modified"))){b.lastModified[bC]=bV}if((b2=bJ.getResponseHeader("Etag"))){b.etag[bC]=b2}}if(bZ===304){bX="notmodified";bT=true}else{try{b4=G(bD,bY);bX="success";bT=true}catch(b1){bX="parsererror";b3=b1}}}else{b3=bX;if(!bX||bZ){bX="error";if(bZ<0){bZ=0}}}bJ.status=bZ;bJ.statusText=""+(bU||bX);if(bT){bR.resolveWith(bS,[b4,bX,bJ])}else{bR.rejectWith(bS,[bJ,bX,b3])}bJ.statusCode(bB);bB=L;if(bw){bG.trigger("ajax"+(bT?"Success":"Error"),[bJ,bD,bT?b4:b3])}bN.fireWith(bS,[bJ,bX]);if(bw){bG.trigger("ajaxComplete",[bJ,bD]);if(!(--b.active)){b.event.trigger("ajaxStop")}}}bR.promise(bJ);bJ.success=bJ.done;bJ.error=bJ.fail;bJ.complete=bN.add;bJ.statusCode=function(bT){if(bT){var e;if(bA<2){for(e in bT){bB[e]=[bB[e],bT[e]]}}else{e=bT[bJ.status];bJ.then(e,e)}}return this};bD.url=((bz||bD.url)+"").replace(bq,"").replace(c,s[1]+"//");bD.dataTypes=b.trim(bD.dataType||"*").toLowerCase().split(h);if(bD.crossDomain==null){bI=K.exec(bD.url.toLowerCase());bD.crossDomain=!!(bI&&(bI[1]!=s[1]||bI[2]!=s[2]||(bI[3]||(bI[1]==="http:"?80:443))!=(s[3]||(s[1]==="http:"?80:443))))}if(bD.data&&bD.processData&&typeof bD.data!=="string"){bD.data=b.param(bD.data,bD.traditional)}aW(aa,bD,bx,bJ);if(bA===2){return false}bw=bD.global;bD.type=bD.type.toUpperCase();bD.hasContent=!aQ.test(bD.type);if(bw&&b.active++===0){b.event.trigger("ajaxStart")}if(!bD.hasContent){if(bD.data){bD.url+=(M.test(bD.url)?"&":"?")+bD.data;delete bD.data}bC=bD.url;if(bD.cache===false){var bv=b.now(),bP=bD.url.replace(br,"$1_="+bv);bD.url=bP+((bP===bD.url)?(M.test(bD.url)?"&":"?")+"_="+bv:"")}}if(bD.data&&bD.hasContent&&bD.contentType!==false||bx.contentType){bJ.setRequestHeader("Content-Type",bD.contentType)}if(bD.ifModified){bC=bC||bD.url;if(b.lastModified[bC]){bJ.setRequestHeader("If-Modified-Since",b.lastModified[bC])}if(b.etag[bC]){bJ.setRequestHeader("If-None-Match",b.etag[bC])}}bJ.setRequestHeader("Accept",bD.dataTypes[0]&&bD.accepts[bD.dataTypes[0]]?bD.accepts[bD.dataTypes[0]]+(bD.dataTypes[0]!=="*"?", "+aV+"; q=0.01":""):bD.accepts["*"]);for(bK in bD.headers){bJ.setRequestHeader(bK,bD.headers[bK])}if(bD.beforeSend&&(bD.beforeSend.call(bS,bJ,bD)===false||bA===2)){bJ.abort();return false}for(bK in {success:1,error:1,complete:1}){bJ[bK](bD[bK])}bL=aW(r,bD,bx,bJ);if(!bL){bF(-1,"No Transport")}else{bJ.readyState=1;if(bw){bG.trigger("ajaxSend",[bJ,bD])}if(bD.async&&bD.timeout>0){bE=setTimeout(function(){bJ.abort("timeout")},bD.timeout)}try{bA=1;bL.send(bH,bF)}catch(bM){if(bA<2){bF(-1,bM)}else{throw bM}}}return bJ},param:function(e,bw){var bv=[],by=function(bz,bA){bA=b.isFunction(bA)?bA():bA;bv[bv.length]=encodeURIComponent(bz)+"="+encodeURIComponent(bA)};if(bw===L){bw=b.ajaxSettings.traditional}if(b.isArray(e)||(e.jquery&&!b.isPlainObject(e))){b.each(e,function(){by(this.name,this.value)})}else{for(var bx in e){v(bx,e[bx],bw,by)}}return bv.join("&").replace(k,"+")}});function v(bw,by,bv,bx){if(b.isArray(by)){b.each(by,function(bA,bz){if(bv||ap.test(bw)){bx(bw,bz)}else{v(bw+"["+(typeof bz==="object"||b.isArray(bz)?bA:"")+"]",bz,bv,bx)}})}else{if(!bv&&by!=null&&typeof by==="object"){for(var e in by){v(bw+"["+e+"]",by[e],bv,bx)}}else{bx(bw,by)}}}b.extend({active:0,lastModified:{},etag:{}});function bj(bD,bC,bz){var bv=bD.contents,bB=bD.dataTypes,bw=bD.responseFields,by,bA,bx,e;for(bA in bw){if(bA in bz){bC[bw[bA]]=bz[bA]}}while(bB[0]==="*"){bB.shift();if(by===L){by=bD.mimeType||bC.getResponseHeader("content-type")}}if(by){for(bA in bv){if(bv[bA]&&bv[bA].test(by)){bB.unshift(bA);break}}}if(bB[0] in bz){bx=bB[0]}else{for(bA in bz){if(!bB[0]||bD.converters[bA+" "+bB[0]]){bx=bA;break}if(!e){e=bA}}bx=bx||e}if(bx){if(bx!==bB[0]){bB.unshift(bx)}return bz[bx]}}function G(bH,bz){if(bH.dataFilter){bz=bH.dataFilter(bz,bH.dataType)}var bD=bH.dataTypes,bG={},bA,bE,bw=bD.length,bB,bC=bD[0],bx,by,bF,bv,e;for(bA=1;bA<bw;bA++){if(bA===1){for(bE in bH.converters){if(typeof bE==="string"){bG[bE.toLowerCase()]=bH.converters[bE]}}}bx=bC;bC=bD[bA];if(bC==="*"){bC=bx}else{if(bx!=="*"&&bx!==bC){by=bx+" "+bC;bF=bG[by]||bG["* "+bC];if(!bF){e=L;for(bv in bG){bB=bv.split(" ");if(bB[0]===bx||bB[0]==="*"){e=bG[bB[1]+" "+bC];if(e){bv=bG[bv];if(bv===true){bF=e}else{if(e===true){bF=bv}}break}}}}if(!(bF||e)){b.error("No conversion from "+by.replace(" "," to "))}if(bF!==true){bz=bF?bF(bz):e(bv(bz))}}}}return bz}var aC=b.now(),u=/(\=)\?(&|$)|\?\?/i;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return b.expando+"_"+(aC++)}});b.ajaxPrefilter("json jsonp",function(bD,bA,bC){var bx=bD.contentType==="application/x-www-form-urlencoded"&&(typeof bD.data==="string");if(bD.dataTypes[0]==="jsonp"||bD.jsonp!==false&&(u.test(bD.url)||bx&&u.test(bD.data))){var bB,bw=bD.jsonpCallback=b.isFunction(bD.jsonpCallback)?bD.jsonpCallback():bD.jsonpCallback,bz=bb[bw],e=bD.url,by=bD.data,bv="$1"+bw+"$2";if(bD.jsonp!==false){e=e.replace(u,bv);if(bD.url===e){if(bx){by=by.replace(u,bv)}if(bD.data===by){e+=(/\?/.test(e)?"&":"?")+bD.jsonp+"="+bw}}}bD.url=e;bD.data=by;bb[bw]=function(bE){bB=[bE]};bC.always(function(){bb[bw]=bz;if(bB&&b.isFunction(bz)){bb[bw](bB[0])}});bD.converters["script json"]=function(){if(!bB){b.error(bw+" was not called")}return bB[0]};bD.dataTypes[0]="json";return"script"}});b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){b.globalEval(e);return e}}});b.ajaxPrefilter("script",function(e){if(e.cache===L){e.cache=false}if(e.crossDomain){e.type="GET";e.global=false}});b.ajaxTransport("script",function(bw){if(bw.crossDomain){var e,bv=av.head||av.getElementsByTagName("head")[0]||av.documentElement;return{send:function(bx,by){e=av.createElement("script");e.async="async";if(bw.scriptCharset){e.charset=bw.scriptCharset}e.src=bw.url;e.onload=e.onreadystatechange=function(bA,bz){if(bz||!e.readyState||/loaded|complete/.test(e.readyState)){e.onload=e.onreadystatechange=null;if(bv&&e.parentNode){bv.removeChild(e)}e=L;if(!bz){by(200,"success")}}};bv.insertBefore(e,bv.firstChild)},abort:function(){if(e){e.onload(0,1)}}}}});var B=bb.ActiveXObject?function(){for(var e in N){N[e](0,1)}}:false,y=0,N;function aL(){try{return new bb.XMLHttpRequest()}catch(bv){}}function aj(){try{return new bb.ActiveXObject("Microsoft.XMLHTTP")}catch(bv){}}b.ajaxSettings.xhr=bb.ActiveXObject?function(){return !this.isLocal&&aL()||aj()}:aL;(function(e){b.extend(b.support,{ajax:!!e,cors:!!e&&("withCredentials" in e)})})(b.ajaxSettings.xhr());if(b.support.ajax){b.ajaxTransport(function(e){if(!e.crossDomain||b.support.cors){var bv;return{send:function(bB,bw){var bA=e.xhr(),bz,by;if(e.username){bA.open(e.type,e.url,e.async,e.username,e.password)}else{bA.open(e.type,e.url,e.async)}if(e.xhrFields){for(by in e.xhrFields){bA[by]=e.xhrFields[by]}}if(e.mimeType&&bA.overrideMimeType){bA.overrideMimeType(e.mimeType)}if(!e.crossDomain&&!bB["X-Requested-With"]){bB["X-Requested-With"]="XMLHttpRequest"}try{for(by in bB){bA.setRequestHeader(by,bB[by])}}catch(bx){}bA.send((e.hasContent&&e.data)||null);bv=function(bK,bE){var bF,bD,bC,bI,bH;try{if(bv&&(bE||bA.readyState===4)){bv=L;if(bz){bA.onreadystatechange=b.noop;if(B){delete N[bz]}}if(bE){if(bA.readyState!==4){bA.abort()}}else{bF=bA.status;bC=bA.getAllResponseHeaders();bI={};bH=bA.responseXML;if(bH&&bH.documentElement){bI.xml=bH}bI.text=bA.responseText;try{bD=bA.statusText}catch(bJ){bD=""}if(!bF&&e.isLocal&&!e.crossDomain){bF=bI.text?200:404}else{if(bF===1223){bF=204}}}}}catch(bG){if(!bE){bw(-1,bG)}}if(bI){bw(bF,bD,bI,bC)}};if(!e.async||bA.readyState===4){bv()}else{bz=++y;if(B){if(!N){N={};b(bb).unload(B)}N[bz]=bv}bA.onreadystatechange=bv}},abort:function(){if(bv){bv(0,1)}}}}})}var Q={},a8,m,aB=/^(?:toggle|show|hide)$/,aT=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,a3,aH=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],a4;b.fn.extend({show:function(bx,bA,bz){var bw,by;if(bx||bx===0){return this.animate(a0("show",3),bx,bA,bz)}else{for(var bv=0,e=this.length;bv<e;bv++){bw=this[bv];if(bw.style){by=bw.style.display;if(!b._data(bw,"olddisplay")&&by==="none"){by=bw.style.display=""}if(by===""&&b.css(bw,"display")==="none"){b._data(bw,"olddisplay",x(bw.nodeName))}}}for(bv=0;bv<e;bv++){bw=this[bv];if(bw.style){by=bw.style.display;if(by===""||by==="none"){bw.style.display=b._data(bw,"olddisplay")||""}}}return this}},hide:function(bx,bA,bz){if(bx||bx===0){return this.animate(a0("hide",3),bx,bA,bz)}else{var bw,by,bv=0,e=this.length;for(;bv<e;bv++){bw=this[bv];if(bw.style){by=b.css(bw,"display");if(by!=="none"&&!b._data(bw,"olddisplay")){b._data(bw,"olddisplay",by)}}}for(bv=0;bv<e;bv++){if(this[bv].style){this[bv].style.display="none"}}return this}},_toggle:b.fn.toggle,toggle:function(bw,bv,bx){var e=typeof bw==="boolean";if(b.isFunction(bw)&&b.isFunction(bv)){this._toggle.apply(this,arguments)}else{if(bw==null||e){this.each(function(){var by=e?bw:b(this).is(":hidden");b(this)[by?"show":"hide"]()})}else{this.animate(a0("toggle",3),bw,bv,bx)}}return this},fadeTo:function(e,bx,bw,bv){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:bx},e,bw,bv)},animate:function(bz,bw,by,bx){var e=b.speed(bw,by,bx);if(b.isEmptyObject(bz)){return this.each(e.complete,[false])}bz=b.extend({},bz);function bv(){if(e.queue===false){b._mark(this)}var bE=b.extend({},e),bK=this.nodeType===1,bI=bK&&b(this).is(":hidden"),bB,bF,bD,bJ,bH,bC,bG,bL,bA;bE.animatedProperties={};for(bD in bz){bB=b.camelCase(bD);if(bD!==bB){bz[bB]=bz[bD];delete bz[bD]}bF=bz[bB];if(b.isArray(bF)){bE.animatedProperties[bB]=bF[1];bF=bz[bB]=bF[0]}else{bE.animatedProperties[bB]=bE.specialEasing&&bE.specialEasing[bB]||bE.easing||"swing"}if(bF==="hide"&&bI||bF==="show"&&!bI){return bE.complete.call(this)}if(bK&&(bB==="height"||bB==="width")){bE.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(b.css(this,"display")==="inline"&&b.css(this,"float")==="none"){if(!b.support.inlineBlockNeedsLayout||x(this.nodeName)==="inline"){this.style.display="inline-block"}else{this.style.zoom=1}}}}if(bE.overflow!=null){this.style.overflow="hidden"}for(bD in bz){bJ=new b.fx(this,bE,bD);bF=bz[bD];if(aB.test(bF)){bA=b._data(this,"toggle"+bD)||(bF==="toggle"?bI?"show":"hide":0);if(bA){b._data(this,"toggle"+bD,bA==="show"?"hide":"show");bJ[bA]()}else{bJ[bF]()}}else{bH=aT.exec(bF);bC=bJ.cur();if(bH){bG=parseFloat(bH[2]);bL=bH[3]||(b.cssNumber[bD]?"":"px");if(bL!=="px"){b.style(this,bD,(bG||1)+bL);bC=((bG||1)/bJ.cur())*bC;b.style(this,bD,bC+bL)}if(bH[1]){bG=((bH[1]==="-="?-1:1)*bG)+bC}bJ.custom(bC,bG,bL)}else{bJ.custom(bC,bF,"")}}}return true}return e.queue===false?this.each(bv):this.queue(e.queue,bv)},stop:function(bw,bv,e){if(typeof bw!=="string"){e=bv;bv=bw;bw=L}if(bv&&bw!==false){this.queue(bw||"fx",[])}return this.each(function(){var bx,by=false,bA=b.timers,bz=b._data(this);if(!e){b._unmark(true,this)}function bB(bE,bF,bD){var bC=bF[bD];b.removeData(bE,bD,true);bC.stop(e)}if(bw==null){for(bx in bz){if(bz[bx]&&bz[bx].stop&&bx.indexOf(".run")===bx.length-4){bB(this,bz,bx)}}}else{if(bz[bx=bw+".run"]&&bz[bx].stop){bB(this,bz,bx)}}for(bx=bA.length;bx--;){if(bA[bx].elem===this&&(bw==null||bA[bx].queue===bw)){if(e){bA[bx](true)}else{bA[bx].saveState()}by=true;bA.splice(bx,1)}}if(!(e&&by)){b.dequeue(this,bw)}})}});function bh(){setTimeout(at,0);return(a4=b.now())}function at(){a4=L}function a0(bv,e){var bw={};b.each(aH.concat.apply([],aH.slice(0,e)),function(){bw[this]=bv});return bw}b.each({slideDown:a0("show",1),slideUp:a0("hide",1),slideToggle:a0("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,bv){b.fn[e]=function(bw,by,bx){return this.animate(bv,bw,by,bx)}});b.extend({speed:function(bw,bx,bv){var e=bw&&typeof bw==="object"?b.extend({},bw):{complete:bv||!bv&&bx||b.isFunction(bw)&&bw,duration:bw,easing:bv&&bx||bx&&!b.isFunction(bx)&&bx};e.duration=b.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in b.fx.speeds?b.fx.speeds[e.duration]:b.fx.speeds._default;if(e.queue==null||e.queue===true){e.queue="fx"}e.old=e.complete;e.complete=function(by){if(b.isFunction(e.old)){e.old.call(this)}if(e.queue){b.dequeue(this,e.queue)}else{if(by!==false){b._unmark(this)}}};return e},easing:{linear:function(bw,bx,e,bv){return e+bv*bw},swing:function(bw,bx,e,bv){return((-Math.cos(bw*Math.PI)/2)+0.5)*bv+e}},timers:[],fx:function(bv,e,bw){this.options=e;this.elem=bv;this.prop=bw;e.orig=e.orig||{}}});b.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(b.fx.step[this.prop]||b.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var e,bv=b.css(this.elem,this.prop);return isNaN(e=parseFloat(bv))?!bv||bv==="auto"?0:bv:e},custom:function(bz,by,bx){var e=this,bw=b.fx;this.startTime=a4||bh();this.end=by;this.now=this.start=bz;this.pos=this.state=0;this.unit=bx||this.unit||(b.cssNumber[this.prop]?"":"px");function bv(bA){return e.step(bA)}bv.queue=this.options.queue;bv.elem=this.elem;bv.saveState=function(){if(e.options.hide&&b._data(e.elem,"fxshow"+e.prop)===L){b._data(e.elem,"fxshow"+e.prop,e.start)}};if(bv()&&b.timers.push(bv)&&!a3){a3=setInterval(bw.tick,bw.interval)}},show:function(){var e=b._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=e||b.style(this.elem,this.prop);this.options.show=true;if(e!==L){this.custom(this.cur(),e)}else{this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur())}b(this.elem).show()},hide:function(){this.options.orig[this.prop]=b._data(this.elem,"fxshow"+this.prop)||b.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(by){var bA,bB,bv,bx=a4||bh(),e=true,bz=this.elem,bw=this.options;if(by||bx>=bw.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();bw.animatedProperties[this.prop]=true;for(bA in bw.animatedProperties){if(bw.animatedProperties[bA]!==true){e=false}}if(e){if(bw.overflow!=null&&!b.support.shrinkWrapBlocks){b.each(["","X","Y"],function(bC,bD){bz.style["overflow"+bD]=bw.overflow[bC]})}if(bw.hide){b(bz).hide()}if(bw.hide||bw.show){for(bA in bw.animatedProperties){b.style(bz,bA,bw.orig[bA]);b.removeData(bz,"fxshow"+bA,true);b.removeData(bz,"toggle"+bA,true)}}bv=bw.complete;if(bv){bw.complete=false;bv.call(bz)}}return false}else{if(bw.duration==Infinity){this.now=bx}else{bB=bx-this.startTime;this.state=bB/bw.duration;this.pos=b.easing[bw.animatedProperties[this.prop]](this.state,bB,0,1,bw.duration);this.now=this.start+((this.end-this.start)*this.pos)}this.update()}return true}};b.extend(b.fx,{tick:function(){var bw,bv=b.timers,e=0;for(;e<bv.length;e++){bw=bv[e];if(!bw()&&bv[e]===bw){bv.splice(e--,1)}}if(!bv.length){b.fx.stop()}},interval:13,stop:function(){clearInterval(a3);a3=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(e){b.style(e.elem,"opacity",e.now)},_default:function(e){if(e.elem.style&&e.elem.style[e.prop]!=null){e.elem.style[e.prop]=e.now+e.unit}else{e.elem[e.prop]=e.now}}}});b.each(["width","height"],function(e,bv){b.fx.step[bv]=function(bw){b.style(bw.elem,bv,Math.max(0,bw.now)+bw.unit)}});if(b.expr&&b.expr.filters){b.expr.filters.animated=function(e){return b.grep(b.timers,function(bv){return e===bv.elem}).length}}function x(bx){if(!Q[bx]){var e=av.body,bv=b("<"+bx+">").appendTo(e),bw=bv.css("display");bv.remove();if(bw==="none"||bw===""){if(!a8){a8=av.createElement("iframe");a8.frameBorder=a8.width=a8.height=0}e.appendChild(a8);if(!m||!a8.createElement){m=(a8.contentWindow||a8.contentDocument).document;m.write((av.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>");m.close()}bv=m.createElement(bx);m.body.appendChild(bv);bw=b.css(bv,"display");e.removeChild(a8)}Q[bx]=bw}return Q[bx]}var V=/^t(?:able|d|h)$/i,ad=/^(?:body|html)$/i;if("getBoundingClientRect" in av.documentElement){b.fn.offset=function(bI){var by=this[0],bB;if(bI){return this.each(function(e){b.offset.setOffset(this,bI,e)})}if(!by||!by.ownerDocument){return null}if(by===by.ownerDocument.body){return b.offset.bodyOffset(by)}try{bB=by.getBoundingClientRect()}catch(bF){}var bH=by.ownerDocument,bw=bH.documentElement;if(!bB||!b.contains(bw,by)){return bB?{top:bB.top,left:bB.left}:{top:0,left:0}}var bC=bH.body,bD=aK(bH),bA=bw.clientTop||bC.clientTop||0,bE=bw.clientLeft||bC.clientLeft||0,bv=bD.pageYOffset||b.support.boxModel&&bw.scrollTop||bC.scrollTop,bz=bD.pageXOffset||b.support.boxModel&&bw.scrollLeft||bC.scrollLeft,bG=bB.top+bv-bA,bx=bB.left+bz-bE;return{top:bG,left:bx}}}else{b.fn.offset=function(bF){var bz=this[0];if(bF){return this.each(function(bG){b.offset.setOffset(this,bF,bG)})}if(!bz||!bz.ownerDocument){return null}if(bz===bz.ownerDocument.body){return b.offset.bodyOffset(bz)}var bC,bw=bz.offsetParent,bv=bz,bE=bz.ownerDocument,bx=bE.documentElement,bA=bE.body,bB=bE.defaultView,e=bB?bB.getComputedStyle(bz,null):bz.currentStyle,bD=bz.offsetTop,by=bz.offsetLeft;while((bz=bz.parentNode)&&bz!==bA&&bz!==bx){if(b.support.fixedPosition&&e.position==="fixed"){break}bC=bB?bB.getComputedStyle(bz,null):bz.currentStyle;bD-=bz.scrollTop;by-=bz.scrollLeft;if(bz===bw){bD+=bz.offsetTop;by+=bz.offsetLeft;if(b.support.doesNotAddBorder&&!(b.support.doesAddBorderForTableAndCells&&V.test(bz.nodeName))){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}bv=bw;bw=bz.offsetParent}if(b.support.subtractsBorderForOverflowNotVisible&&bC.overflow!=="visible"){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}e=bC}if(e.position==="relative"||e.position==="static"){bD+=bA.offsetTop;by+=bA.offsetLeft}if(b.support.fixedPosition&&e.position==="fixed"){bD+=Math.max(bx.scrollTop,bA.scrollTop);by+=Math.max(bx.scrollLeft,bA.scrollLeft)}return{top:bD,left:by}}}b.offset={bodyOffset:function(e){var bw=e.offsetTop,bv=e.offsetLeft;if(b.support.doesNotIncludeMarginInBodyOffset){bw+=parseFloat(b.css(e,"marginTop"))||0;bv+=parseFloat(b.css(e,"marginLeft"))||0}return{top:bw,left:bv}},setOffset:function(bx,bG,bA){var bB=b.css(bx,"position");if(bB==="static"){bx.style.position="relative"}var bz=b(bx),bv=bz.offset(),e=b.css(bx,"top"),bE=b.css(bx,"left"),bF=(bB==="absolute"||bB==="fixed")&&b.inArray("auto",[e,bE])>-1,bD={},bC={},bw,by;if(bF){bC=bz.position();bw=bC.top;by=bC.left}else{bw=parseFloat(e)||0;by=parseFloat(bE)||0}if(b.isFunction(bG)){bG=bG.call(bx,bA,bv)}if(bG.top!=null){bD.top=(bG.top-bv.top)+bw}if(bG.left!=null){bD.left=(bG.left-bv.left)+by}if("using" in bG){bG.using.call(bx,bD)}else{bz.css(bD)}}};b.fn.extend({position:function(){if(!this[0]){return null}var bw=this[0],bv=this.offsetParent(),bx=this.offset(),e=ad.test(bv[0].nodeName)?{top:0,left:0}:bv.offset();bx.top-=parseFloat(b.css(bw,"marginTop"))||0;bx.left-=parseFloat(b.css(bw,"marginLeft"))||0;e.top+=parseFloat(b.css(bv[0],"borderTopWidth"))||0;e.left+=parseFloat(b.css(bv[0],"borderLeftWidth"))||0;return{top:bx.top-e.top,left:bx.left-e.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||av.body;while(e&&(!ad.test(e.nodeName)&&b.css(e,"position")==="static")){e=e.offsetParent}return e})}});b.each(["Left","Top"],function(bv,e){var bw="scroll"+e;b.fn[bw]=function(bz){var bx,by;if(bz===L){bx=this[0];if(!bx){return null}by=aK(bx);return by?("pageXOffset" in by)?by[bv?"pageYOffset":"pageXOffset"]:b.support.boxModel&&by.document.documentElement[bw]||by.document.body[bw]:bx[bw]}return this.each(function(){by=aK(this);if(by){by.scrollTo(!bv?bz:b(by).scrollLeft(),bv?bz:b(by).scrollTop())}else{this[bw]=bz}})}});function aK(e){return b.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}b.each(["Height","Width"],function(bv,e){var bw=e.toLowerCase();b.fn["inner"+e]=function(){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,"padding")):this[bw]():null};b.fn["outer"+e]=function(by){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,by?"margin":"border")):this[bw]():null};b.fn[bw]=function(bz){var bA=this[0];if(!bA){return bz==null?null:this}if(b.isFunction(bz)){return this.each(function(bE){var bD=b(this);bD[bw](bz.call(this,bE,bD[bw]()))})}if(b.isWindow(bA)){var bB=bA.document.documentElement["client"+e],bx=bA.document.body;return bA.document.compatMode==="CSS1Compat"&&bB||bx&&bx["client"+e]||bB}else{if(bA.nodeType===9){return Math.max(bA.documentElement["client"+e],bA.body["scroll"+e],bA.documentElement["scroll"+e],bA.body["offset"+e],bA.documentElement["offset"+e])}else{if(bz===L){var bC=b.css(bA,bw),by=parseFloat(bC);return b.isNumeric(by)?by:bC}else{return this.css(bw,typeof bz==="string"?bz:bz+"px")}}}}});bb.jQuery=bb.$=b;if(typeof define==="function"&&define.amd&&define.amd.jQuery){define("jquery",[],function(){return b})}})(window);/*!
+ * jQuery UI 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI
+ */
+(function(a,d){a.ui=a.ui||{};if(a.ui.version){return}a.extend(a.ui,{version:"1.8.18",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(e,f){return typeof e==="number"?this.each(function(){var g=this;setTimeout(function(){a(g).focus();if(f){f.call(g)}},e)}):this._focus.apply(this,arguments)},scrollParent:function(){var e;if((a.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){e=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(a.curCSS(this,"position",1))&&(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}else{e=this.parents().filter(function(){return(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!e.length?a(document):e},zIndex:function(h){if(h!==d){return this.css("zIndex",h)}if(this.length){var f=a(this[0]),e,g;while(f.length&&f[0]!==document){e=f.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){g=parseInt(f.css("zIndex"),10);if(!isNaN(g)&&g!==0){return g}}f=f.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});a.each(["Width","Height"],function(g,e){var f=e==="Width"?["Left","Right"]:["Top","Bottom"],h=e.toLowerCase(),k={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};function j(m,l,i,n){a.each(f,function(){l-=parseFloat(a.curCSS(m,"padding"+this,true))||0;if(i){l-=parseFloat(a.curCSS(m,"border"+this+"Width",true))||0}if(n){l-=parseFloat(a.curCSS(m,"margin"+this,true))||0}});return l}a.fn["inner"+e]=function(i){if(i===d){return k["inner"+e].call(this)}return this.each(function(){a(this).css(h,j(this,i)+"px")})};a.fn["outer"+e]=function(i,l){if(typeof i!=="number"){return k["outer"+e].call(this,i)}return this.each(function(){a(this).css(h,j(this,i,true,l)+"px")})}});function c(g,e){var j=g.nodeName.toLowerCase();if("area"===j){var i=g.parentNode,h=i.name,f;if(!g.href||!h||i.nodeName.toLowerCase()!=="map"){return false}f=a("img[usemap=#"+h+"]")[0];return !!f&&b(f)}return(/input|select|textarea|button|object/.test(j)?!g.disabled:"a"==j?g.href||e:e)&&b(g)}function b(e){return !a(e).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.extend(a.expr[":"],{data:function(g,f,e){return !!a.data(g,e[3])},focusable:function(e){return c(e,!isNaN(a.attr(e,"tabindex")))},tabbable:function(g){var e=a.attr(g,"tabindex"),f=isNaN(e);return(f||e>=0)&&c(g,!f)}});a(function(){var e=document.body,f=e.appendChild(f=document.createElement("div"));f.offsetHeight;a.extend(f.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});a.support.minHeight=f.offsetHeight===100;a.support.selectstart="onselectstart" in f;e.removeChild(f).style.display="none"});a.extend(a.ui,{plugin:{add:function(f,g,j){var h=a.ui[f].prototype;for(var e in j){h.plugins[e]=h.plugins[e]||[];h.plugins[e].push([g,j[e]])}},call:function(e,g,f){var j=e.plugins[g];if(!j||!e.element[0].parentNode){return}for(var h=0;h<j.length;h++){if(e.options[j[h][0]]){j[h][1].apply(e.element,f)}}}},contains:function(f,e){return document.compareDocumentPosition?f.compareDocumentPosition(e)&16:f!==e&&f.contains(e)},hasScroll:function(h,f){if(a(h).css("overflow")==="hidden"){return false}var e=(f&&f==="left")?"scrollLeft":"scrollTop",g=false;if(h[e]>0){return true}h[e]=1;g=(h[e]>0);h[e]=0;return g},isOverAxis:function(f,e,g){return(f>e)&&(f<(e+g))},isOver:function(j,f,i,h,e,g){return a.ui.isOverAxis(j,i,e)&&a.ui.isOverAxis(f,h,g)}})})(jQuery);/*!
+ * jQuery UI Widget 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Widget
+ */
+(function(b,d){if(b.cleanData){var c=b.cleanData;b.cleanData=function(f){for(var g=0,h;(h=f[g])!=null;g++){try{b(h).triggerHandler("remove")}catch(j){}}c(f)}}else{var a=b.fn.remove;b.fn.remove=function(e,f){return this.each(function(){if(!f){if(!e||b.filter(e,[this]).length){b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(g){}})}}return a.call(b(this),e,f)})}}b.widget=function(f,h,e){var g=f.split(".")[0],j;f=f.split(".")[1];j=g+"-"+f;if(!e){e=h;h=b.Widget}b.expr[":"][j]=function(k){return !!b.data(k,f)};b[g]=b[g]||{};b[g][f]=function(k,l){if(arguments.length){this._createWidget(k,l)}};var i=new h();i.options=b.extend(true,{},i.options);b[g][f].prototype=b.extend(true,i,{namespace:g,widgetName:f,widgetEventPrefix:b[g][f].prototype.widgetEventPrefix||f,widgetBaseClass:j},e);b.widget.bridge(f,b[g][f])};b.widget.bridge=function(f,e){b.fn[f]=function(i){var g=typeof i==="string",h=Array.prototype.slice.call(arguments,1),j=this;i=!g&&h.length?b.extend.apply(null,[true,i].concat(h)):i;if(g&&i.charAt(0)==="_"){return j}if(g){this.each(function(){var k=b.data(this,f),l=k&&b.isFunction(k[i])?k[i].apply(k,h):k;if(l!==k&&l!==d){j=l;return false}})}else{this.each(function(){var k=b.data(this,f);if(k){k.option(i||{})._init()}else{b.data(this,f,new e(i,this))}})}return j}};b.Widget=function(e,f){if(arguments.length){this._createWidget(e,f)}};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(f,g){b.data(g,this.widgetName,this);this.element=b(g);this.options=b.extend(true,{},this.options,this._getCreateOptions(),f);var e=this;this.element.bind("remove."+this.widgetName,function(){e.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(f,g){var e=f;if(arguments.length===0){return b.extend({},this.options)}if(typeof f==="string"){if(g===d){return this.options[f]}e={};e[f]=g}this._setOptions(e);return this},_setOptions:function(f){var e=this;b.each(f,function(g,h){e._setOption(g,h)});return this},_setOption:function(e,f){this.options[e]=f;if(e==="disabled"){this.widget()[f?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",f)}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(e,f,g){var j,i,h=this.options[e];g=g||{};f=b.Event(f);f.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase();f.target=this.element[0];i=f.originalEvent;if(i){for(j in i){if(!(j in f)){f[j]=i[j]}}}this.element.trigger(f,g);return !(b.isFunction(h)&&h.call(this.element[0],f,g)===false||f.isDefaultPrevented())}}})(jQuery);/*!
+ * jQuery UI Mouse 1.8.18
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Mouse
+ *
+ * Depends:
+ *	jquery.ui.widget.js
+ */
+(function(b,c){var a=false;b(document).mouseup(function(d){a=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var d=this;this.element.bind("mousedown."+this.widgetName,function(e){return d._mouseDown(e)}).bind("click."+this.widgetName,function(e){if(true===b.data(e.target,d.widgetName+".preventClickEvent")){b.removeData(e.target,d.widgetName+".preventClickEvent");e.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(f){if(a){return}(this._mouseStarted&&this._mouseUp(f));this._mouseDownEvent=f;var e=this,g=(f.which==1),d=(typeof this.options.cancel=="string"&&f.target.nodeName?b(f.target).closest(this.options.cancel).length:false);if(!g||d||!this._mouseCapture(f)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){e.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(f)&&this._mouseDelayMet(f)){this._mouseStarted=(this._mouseStart(f)!==false);if(!this._mouseStarted){f.preventDefault();return true}}if(true===b.data(f.target,this.widgetName+".preventClickEvent")){b.removeData(f.target,this.widgetName+".preventClickEvent")}this._mouseMoveDelegate=function(h){return e._mouseMove(h)};this._mouseUpDelegate=function(h){return e._mouseUp(h)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);f.preventDefault();a=true;return true},_mouseMove:function(d){if(b.browser.msie&&!(document.documentMode>=9)&&!d.button){return this._mouseUp(d)}if(this._mouseStarted){this._mouseDrag(d);return d.preventDefault()}if(this._mouseDistanceMet(d)&&this._mouseDelayMet(d)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,d)!==false);(this._mouseStarted?this._mouseDrag(d):this._mouseUp(d))}return !this._mouseStarted},_mouseUp:function(d){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(d.target==this._mouseDownEvent.target){b.data(d.target,this.widgetName+".preventClickEvent",true)}this._mouseStop(d)}return false},_mouseDistanceMet:function(d){return(Math.max(Math.abs(this._mouseDownEvent.pageX-d.pageX),Math.abs(this._mouseDownEvent.pageY-d.pageY))>=this.options.distance)},_mouseDelayMet:function(d){return this.mouseDelayMet},_mouseStart:function(d){},_mouseDrag:function(d){},_mouseStop:function(d){},_mouseCapture:function(d){return true}})})(jQuery);(function(c,d){c.widget("ui.resizable",c.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000},_create:function(){var f=this,k=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(k.aspectRatio),aspectRatio:k.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:k.helper||k.ghost||k.animate?k.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){this.element.wrap(c('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=k.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var l=this.handles.split(",");this.handles={};for(var g=0;g<l.length;g++){var j=c.trim(l[g]),e="ui-resizable-"+j;var h=c('<div class="ui-resizable-handle '+e+'"></div>');if(/sw|se|ne|nw/.test(j)){h.css({zIndex:++k.zIndex})}if("se"==j){h.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[j]=".ui-resizable-"+j;this.element.append(h)}}this._renderAxis=function(q){q=q||this.element;for(var n in this.handles){if(this.handles[n].constructor==String){this.handles[n]=c(this.handles[n],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var o=c(this.handles[n],this.element),p=0;p=/sw|ne|nw|se|n|s/.test(n)?o.outerHeight():o.outerWidth();var m=["padding",/ne|nw|n/.test(n)?"Top":/se|sw|s/.test(n)?"Bottom":/^e$/.test(n)?"Right":"Left"].join("");q.css(m,p);this._proportionallyResize()}if(!c(this.handles[n]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!f.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}f.axis=i&&i[1]?i[1]:"se"}});if(k.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){if(k.disabled){return}c(this).removeClass("ui-resizable-autohide");f._handles.show()},function(){if(k.disabled){return}if(!f.resizing){c(this).addClass("ui-resizable-autohide");f._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var e=function(g){c(g).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){e(this.element);var f=this.element;f.after(this.originalElement.css({position:f.css("position"),width:f.outerWidth(),height:f.outerHeight(),top:f.css("top"),left:f.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);e(this.originalElement);return this},_mouseCapture:function(f){var g=false;for(var e in this.handles){if(c(this.handles[e])[0]==f.target){g=true}}return !this.options.disabled&&g},_mouseStart:function(g){var j=this.options,f=this.element.position(),e=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(e.is(".ui-draggable")||(/absolute/).test(e.css("position"))){e.css({position:"absolute",top:f.top,left:f.left})}this._renderProxy();var k=b(this.helper.css("left")),h=b(this.helper.css("top"));if(j.containment){k+=c(j.containment).scrollLeft()||0;h+=c(j.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:k,top:h};this.size=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalSize=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalPosition={left:k,top:h};this.sizeDiff={width:e.outerWidth()-e.width(),height:e.outerHeight()-e.height()};this.originalMousePosition={left:g.pageX,top:g.pageY};this.aspectRatio=(typeof j.aspectRatio=="number")?j.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var i=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",i=="auto"?this.axis+"-resize":i);e.addClass("ui-resizable-resizing");this._propagate("start",g);return true},_mouseDrag:function(e){var h=this.helper,g=this.options,m={},q=this,j=this.originalMousePosition,n=this.axis;var r=(e.pageX-j.left)||0,p=(e.pageY-j.top)||0;var i=this._change[n];if(!i){return false}var l=i.apply(this,[e,r,p]),k=c.browser.msie&&c.browser.version<7,f=this.sizeDiff;this._updateVirtualBoundaries(e.shiftKey);if(this._aspectRatio||e.shiftKey){l=this._updateRatio(l,e)}l=this._respectSize(l,e);this._propagate("resize",e);h.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(l);this._trigger("resize",e,this.ui());return false},_mouseStop:function(h){this.resizing=false;var i=this.options,m=this;if(this._helper){var g=this._proportionallyResizeElements,e=g.length&&(/textarea/i).test(g[0].nodeName),f=e&&c.ui.hasScroll(g[0],"left")?0:m.sizeDiff.height,k=e?0:m.sizeDiff.width;var n={width:(m.helper.width()-k),height:(m.helper.height()-f)},j=(parseInt(m.element.css("left"),10)+(m.position.left-m.originalPosition.left))||null,l=(parseInt(m.element.css("top"),10)+(m.position.top-m.originalPosition.top))||null;if(!i.animate){this.element.css(c.extend(n,{top:l,left:j}))}m.helper.height(m.size.height);m.helper.width(m.size.width);if(this._helper&&!i.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",h);if(this._helper){this.helper.remove()}return false},_updateVirtualBoundaries:function(g){var j=this.options,i,h,f,k,e;e={minWidth:a(j.minWidth)?j.minWidth:0,maxWidth:a(j.maxWidth)?j.maxWidth:Infinity,minHeight:a(j.minHeight)?j.minHeight:0,maxHeight:a(j.maxHeight)?j.maxHeight:Infinity};if(this._aspectRatio||g){i=e.minHeight*this.aspectRatio;f=e.minWidth/this.aspectRatio;h=e.maxHeight*this.aspectRatio;k=e.maxWidth/this.aspectRatio;if(i>e.minWidth){e.minWidth=i}if(f>e.minHeight){e.minHeight=f}if(h<e.maxWidth){e.maxWidth=h}if(k<e.maxHeight){e.maxHeight=k}}this._vBoundaries=e},_updateCache:function(e){var f=this.options;this.offset=this.helper.offset();if(a(e.left)){this.position.left=e.left}if(a(e.top)){this.position.top=e.top}if(a(e.height)){this.size.height=e.height}if(a(e.width)){this.size.width=e.width}},_updateRatio:function(h,g){var i=this.options,j=this.position,f=this.size,e=this.axis;if(a(h.height)){h.width=(h.height*this.aspectRatio)}else{if(a(h.width)){h.height=(h.width/this.aspectRatio)}}if(e=="sw"){h.left=j.left+(f.width-h.width);h.top=null}if(e=="nw"){h.top=j.top+(f.height-h.height);h.left=j.left+(f.width-h.width)}return h},_respectSize:function(l,g){var j=this.helper,i=this._vBoundaries,r=this._aspectRatio||g.shiftKey,q=this.axis,t=a(l.width)&&i.maxWidth&&(i.maxWidth<l.width),m=a(l.height)&&i.maxHeight&&(i.maxHeight<l.height),h=a(l.width)&&i.minWidth&&(i.minWidth>l.width),s=a(l.height)&&i.minHeight&&(i.minHeight>l.height);if(h){l.width=i.minWidth}if(s){l.height=i.minHeight}if(t){l.width=i.maxWidth}if(m){l.height=i.maxHeight}var f=this.originalPosition.left+this.originalSize.width,p=this.position.top+this.size.height;var k=/sw|nw|w/.test(q),e=/nw|ne|n/.test(q);if(h&&k){l.left=f-i.minWidth}if(t&&k){l.left=f-i.maxWidth}if(s&&e){l.top=p-i.minHeight}if(m&&e){l.top=p-i.maxHeight}var n=!l.width&&!l.height;if(n&&!l.left&&l.top){l.top=null}else{if(n&&!l.top&&l.left){l.left=null}}return l},_proportionallyResize:function(){var k=this.options;if(!this._proportionallyResizeElements.length){return}var g=this.helper||this.element;for(var f=0;f<this._proportionallyResizeElements.length;f++){var h=this._proportionallyResizeElements[f];if(!this.borderDif){var e=[h.css("borderTopWidth"),h.css("borderRightWidth"),h.css("borderBottomWidth"),h.css("borderLeftWidth")],j=[h.css("paddingTop"),h.css("paddingRight"),h.css("paddingBottom"),h.css("paddingLeft")];this.borderDif=c.map(e,function(l,n){var m=parseInt(l,10)||0,o=parseInt(j[n],10)||0;return m+o})}if(c.browser.msie&&!(!(c(g).is(":hidden")||c(g).parents(":hidden").length))){continue}h.css({height:(g.height()-this.borderDif[0]-this.borderDif[2])||0,width:(g.width()-this.borderDif[1]-this.borderDif[3])||0})}},_renderProxy:function(){var f=this.element,i=this.options;this.elementOffset=f.offset();if(this._helper){this.helper=this.helper||c('<div style="overflow:hidden;"></div>');var e=c.browser.msie&&c.browser.version<7,g=(e?1:0),h=(e?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+h,height:this.element.outerHeight()+h,position:"absolute",left:this.elementOffset.left-g+"px",top:this.elementOffset.top-g+"px",zIndex:++i.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(g,f,e){return{width:this.originalSize.width+f}},w:function(h,f,e){var j=this.options,g=this.originalSize,i=this.originalPosition;return{left:i.left+f,width:g.width-f}},n:function(h,f,e){var j=this.options,g=this.originalSize,i=this.originalPosition;return{top:i.top+e,height:g.height-e}},s:function(g,f,e){return{height:this.originalSize.height+e}},se:function(g,f,e){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[g,f,e]))},sw:function(g,f,e){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[g,f,e]))},ne:function(g,f,e){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[g,f,e]))},nw:function(g,f,e){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[g,f,e]))}},_propagate:function(f,e){c.ui.plugin.call(this,f,[e,this.ui()]);(f!="resize"&&this._trigger(f,e,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});c.extend(c.ui.resizable,{version:"1.8.18"});c.ui.plugin.add("resizable","alsoResize",{start:function(f,g){var e=c(this).data("resizable"),i=e.options;var h=function(j){c(j).each(function(){var k=c(this);k.data("resizable-alsoresize",{width:parseInt(k.width(),10),height:parseInt(k.height(),10),left:parseInt(k.css("left"),10),top:parseInt(k.css("top"),10)})})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.parentNode){if(i.alsoResize.length){i.alsoResize=i.alsoResize[0];h(i.alsoResize)}else{c.each(i.alsoResize,function(j){h(j)})}}else{h(i.alsoResize)}},resize:function(g,i){var f=c(this).data("resizable"),j=f.options,h=f.originalSize,l=f.originalPosition;var k={height:(f.size.height-h.height)||0,width:(f.size.width-h.width)||0,top:(f.position.top-l.top)||0,left:(f.position.left-l.left)||0},e=function(m,n){c(m).each(function(){var q=c(this),r=c(this).data("resizable-alsoresize"),p={},o=n&&n.length?n:q.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];c.each(o,function(s,u){var t=(r[u]||0)+(k[u]||0);if(t&&t>=0){p[u]=t||null}});q.css(p)})};if(typeof(j.alsoResize)=="object"&&!j.alsoResize.nodeType){c.each(j.alsoResize,function(m,n){e(m,n)})}else{e(j.alsoResize)}},stop:function(e,f){c(this).removeData("resizable-alsoresize")}});c.ui.plugin.add("resizable","animate",{stop:function(i,n){var p=c(this).data("resizable"),j=p.options;var h=p._proportionallyResizeElements,e=h.length&&(/textarea/i).test(h[0].nodeName),f=e&&c.ui.hasScroll(h[0],"left")?0:p.sizeDiff.height,l=e?0:p.sizeDiff.width;var g={width:(p.size.width-l),height:(p.size.height-f)},k=(parseInt(p.element.css("left"),10)+(p.position.left-p.originalPosition.left))||null,m=(parseInt(p.element.css("top"),10)+(p.position.top-p.originalPosition.top))||null;p.element.animate(c.extend(g,m&&k?{top:m,left:k}:{}),{duration:j.animateDuration,easing:j.animateEasing,step:function(){var o={width:parseInt(p.element.css("width"),10),height:parseInt(p.element.css("height"),10),top:parseInt(p.element.css("top"),10),left:parseInt(p.element.css("left"),10)};if(h&&h.length){c(h[0]).css({width:o.width,height:o.height})}p._updateCache(o);p._propagate("resize",i)}})}});c.ui.plugin.add("resizable","containment",{start:function(f,r){var t=c(this).data("resizable"),j=t.options,l=t.element;var g=j.containment,k=(g instanceof c)?g.get(0):(/parent/.test(g))?l.parent().get(0):g;if(!k){return}t.containerElement=c(k);if(/document/.test(g)||g==document){t.containerOffset={left:0,top:0};t.containerPosition={left:0,top:0};t.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var n=c(k),i=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){i[p]=b(n.css("padding"+o))});t.containerOffset=n.offset();t.containerPosition=n.position();t.containerSize={height:(n.innerHeight()-i[3]),width:(n.innerWidth()-i[1])};var q=t.containerOffset,e=t.containerSize.height,m=t.containerSize.width,h=(c.ui.hasScroll(k,"left")?k.scrollWidth:m),s=(c.ui.hasScroll(k)?k.scrollHeight:e);t.parentData={element:k,left:q.left,top:q.top,width:h,height:s}}},resize:function(g,q){var t=c(this).data("resizable"),i=t.options,f=t.containerSize,p=t.containerOffset,m=t.size,n=t.position,r=t._aspectRatio||g.shiftKey,e={top:0,left:0},h=t.containerElement;if(h[0]!=document&&(/static/).test(h.css("position"))){e=p}if(n.left<(t._helper?p.left:0)){t.size.width=t.size.width+(t._helper?(t.position.left-p.left):(t.position.left-e.left));if(r){t.size.height=t.size.width/i.aspectRatio}t.position.left=i.helper?p.left:0}if(n.top<(t._helper?p.top:0)){t.size.height=t.size.height+(t._helper?(t.position.top-p.top):t.position.top);if(r){t.size.width=t.size.height*i.aspectRatio}t.position.top=t._helper?p.top:0}t.offset.left=t.parentData.left+t.position.left;t.offset.top=t.parentData.top+t.position.top;var l=Math.abs((t._helper?t.offset.left-e.left:(t.offset.left-e.left))+t.sizeDiff.width),s=Math.abs((t._helper?t.offset.top-e.top:(t.offset.top-p.top))+t.sizeDiff.height);var k=t.containerElement.get(0)==t.element.parent().get(0),j=/relative|absolute/.test(t.containerElement.css("position"));if(k&&j){l-=t.parentData.left}if(l+t.size.width>=t.parentData.width){t.size.width=t.parentData.width-l;if(r){t.size.height=t.size.width/t.aspectRatio}}if(s+t.size.height>=t.parentData.height){t.size.height=t.parentData.height-s;if(r){t.size.width=t.size.height*t.aspectRatio}}},stop:function(f,n){var q=c(this).data("resizable"),g=q.options,l=q.position,m=q.containerOffset,e=q.containerPosition,i=q.containerElement;var j=c(q.helper),r=j.offset(),p=j.outerWidth()-q.sizeDiff.width,k=j.outerHeight()-q.sizeDiff.height;if(q._helper&&!g.animate&&(/relative/).test(i.css("position"))){c(this).css({left:r.left-e.left-m.left,width:p,height:k})}if(q._helper&&!g.animate&&(/static/).test(i.css("position"))){c(this).css({left:r.left-e.left-m.left,width:p,height:k})}}});c.ui.plugin.add("resizable","ghost",{start:function(g,h){var e=c(this).data("resizable"),i=e.options,f=e.size;e.ghost=e.originalElement.clone();e.ghost.css({opacity:0.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof i.ghost=="string"?i.ghost:"");e.ghost.appendTo(e.helper)},resize:function(f,g){var e=c(this).data("resizable"),h=e.options;if(e.ghost){e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})}},stop:function(f,g){var e=c(this).data("resizable"),h=e.options;if(e.ghost&&e.helper){e.helper.get(0).removeChild(e.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(e,m){var p=c(this).data("resizable"),h=p.options,k=p.size,i=p.originalSize,j=p.originalPosition,n=p.axis,l=h._aspectRatio||e.shiftKey;h.grid=typeof h.grid=="number"?[h.grid,h.grid]:h.grid;var g=Math.round((k.width-i.width)/(h.grid[0]||1))*(h.grid[0]||1),f=Math.round((k.height-i.height)/(h.grid[1]||1))*(h.grid[1]||1);if(/^(se|s|e)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f}else{if(/^(ne)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f;p.position.top=j.top-f}else{if(/^(sw)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f;p.position.left=j.left-g}else{p.size.width=i.width+g;p.size.height=i.height+f;p.position.top=j.top-f;p.position.left=j.left-g}}}}});var b=function(e){return parseInt(e,10)||0};var a=function(e){return !isNaN(parseInt(e,10))}})(jQuery);/*!
+ * jQuery hashchange event - v1.3 - 7/21/2010
+ * http://benalman.com/projects/jquery-hashchange-plugin/
+ * 
+ * Copyright (c) 2010 "Cowboy" Ben Alman
+ * Dual licensed under the MIT and GPL licenses.
+ * http://benalman.com/about/license/
+ */
+(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);(function(c){var a=c.scrollTo=function(f,e,d){c(window).scrollTo(f,e,d)};a.defaults={axis:"xy",duration:parseFloat(c.fn.jquery)>=1.3?0:1};a.window=function(d){return c(window)._scrollable()};c.fn._scrollable=function(){return this.map(function(){var e=this,d=!e.nodeName||c.inArray(e.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1;if(!d){return e}var f=(e.contentWindow||e).document||e.ownerDocument||e;return c.browser.safari||f.compatMode=="BackCompat"?f.body:f.documentElement})};c.fn.scrollTo=function(f,e,d){if(typeof e=="object"){d=e;e=0}if(typeof d=="function"){d={onAfter:d}}if(f=="max"){f=9000000000}d=c.extend({},a.defaults,d);e=e||d.speed||d.duration;d.queue=d.queue&&d.axis.length>1;if(d.queue){e/=2}d.offset=b(d.offset);d.over=b(d.over);return this._scrollable().each(function(){var l=this,j=c(l),k=f,i,g={},m=j.is("html,body");switch(typeof k){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(k)){k=b(k);break}k=c(k,this);case"object":if(k.is||k.style){i=(k=c(k)).offset()}}c.each(d.axis.split(""),function(q,r){var s=r=="x"?"Left":"Top",u=s.toLowerCase(),p="scroll"+s,o=l[p],n=a.max(l,r);if(i){g[p]=i[u]+(m?0:o-j.offset()[u]);if(d.margin){g[p]-=parseInt(k.css("margin"+s))||0;g[p]-=parseInt(k.css("border"+s+"Width"))||0}g[p]+=d.offset[u]||0;if(d.over[u]){g[p]+=k[r=="x"?"width":"height"]()*d.over[u]}}else{var t=k[u];g[p]=t.slice&&t.slice(-1)=="%"?parseFloat(t)/100*n:t}if(/^\d+$/.test(g[p])){g[p]=g[p]<=0?0:Math.min(g[p],n)}if(!q&&d.queue){if(o!=g[p]){h(d.onAfterFirst)}delete g[p]}});h(d.onAfter);function h(n){j.animate(g,e,d.easing,n&&function(){n.call(this,f,d)})}}).end()};a.max=function(j,i){var h=i=="x"?"Width":"Height",e="scroll"+h;if(!c(j).is("html,body")){return j[e]-c(j)[h.toLowerCase()]()}var g="client"+h,f=j.ownerDocument.documentElement,d=j.ownerDocument.body;return Math.max(f[e],d[e])-Math.min(f[g],d[g])};function b(d){return typeof d=="object"?d:{top:d,left:d}}})(jQuery);/*!
+ PowerTip - v1.2.0 - 2013-04-03
+ http://stevenbenner.github.com/jquery-powertip/
+ Copyright (c) 2013 Steven Benner (http://stevenbenner.com/).
+ Released under MIT license.
+ https://raw.github.com/stevenbenner/jquery-powertip/master/LICENSE.txt
+*/
+(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{a(jQuery)}}(function(k){var A=k(document),s=k(window),w=k("body");var n="displayController",e="hasActiveHover",d="forcedOpen",u="hasMouseMove",f="mouseOnToPopup",g="originalTitle",y="powertip",o="powertipjq",l="powertiptarget",E=180/Math.PI;var c={isTipOpen:false,isFixedTipOpen:false,isClosing:false,tipOpenImminent:false,activeHover:null,currentX:0,currentY:0,previousX:0,previousY:0,desyncTimeout:null,mouseTrackingActive:false,delayInProgress:false,windowWidth:0,windowHeight:0,scrollTop:0,scrollLeft:0};var p={none:0,top:1,bottom:2,left:4,right:8};k.fn.powerTip=function(F,N){if(!this.length){return this}if(k.type(F)==="string"&&k.powerTip[F]){return k.powerTip[F].call(this,this,N)}var O=k.extend({},k.fn.powerTip.defaults,F),G=new x(O);h();this.each(function M(){var R=k(this),Q=R.data(y),P=R.data(o),T=R.data(l),S;if(R.data(n)){k.powerTip.destroy(R)}S=R.attr("title");if(!Q&&!T&&!P&&S){R.data(y,S);R.data(g,S);R.removeAttr("title")}R.data(n,new t(R,O,G))});if(!O.manual){this.on({"mouseenter.powertip":function J(P){k.powerTip.show(this,P)},"mouseleave.powertip":function L(){k.powerTip.hide(this)},"focus.powertip":function K(){k.powerTip.show(this)},"blur.powertip":function H(){k.powerTip.hide(this,true)},"keydown.powertip":function I(P){if(P.keyCode===27){k.powerTip.hide(this,true)}}})}return this};k.fn.powerTip.defaults={fadeInTime:200,fadeOutTime:100,followMouse:false,popupId:"powerTip",intentSensitivity:7,intentPollInterval:100,closeDelay:100,placement:"n",smartPlacement:false,offset:10,mouseOnToPopup:false,manual:false};k.fn.powerTip.smartPlacementLists={n:["n","ne","nw","s"],e:["e","ne","se","w","nw","sw","n","s","e"],s:["s","se","sw","n"],w:["w","nw","sw","e","ne","se","n","s","w"],nw:["nw","w","sw","n","s","se","nw"],ne:["ne","e","se","n","s","sw","ne"],sw:["sw","w","nw","s","n","ne","sw"],se:["se","e","ne","s","n","nw","se"],"nw-alt":["nw-alt","n","ne-alt","sw-alt","s","se-alt","w","e"],"ne-alt":["ne-alt","n","nw-alt","se-alt","s","sw-alt","e","w"],"sw-alt":["sw-alt","s","se-alt","nw-alt","n","ne-alt","w","e"],"se-alt":["se-alt","s","sw-alt","ne-alt","n","nw-alt","e","w"]};k.powerTip={show:function z(F,G){if(G){i(G);c.previousX=G.pageX;c.previousY=G.pageY;k(F).data(n).show()}else{k(F).first().data(n).show(true,true)}return F},reposition:function r(F){k(F).first().data(n).resetPosition();return F},hide:function D(G,F){if(G){k(G).first().data(n).hide(F)}else{if(c.activeHover){c.activeHover.data(n).hide(true)}}return G},destroy:function C(G){k(G).off(".powertip").each(function F(){var I=k(this),H=[g,n,e,d];if(I.data(g)){I.attr("title",I.data(g));H.push(y)}I.removeData(H)});return G}};k.powerTip.showTip=k.powerTip.show;k.powerTip.closeTip=k.powerTip.hide;function b(){var F=this;F.top="auto";F.left="auto";F.right="auto";F.bottom="auto";F.set=function(H,G){if(k.isNumeric(G)){F[H]=Math.round(G)}}}function t(K,N,F){var J=null;function L(P,Q){M();if(!K.data(e)){if(!P){c.tipOpenImminent=true;J=setTimeout(function O(){J=null;I()},N.intentPollInterval)}else{if(Q){K.data(d,true)}F.showTip(K)}}}function G(P){M();c.tipOpenImminent=false;if(K.data(e)){K.data(d,false);if(!P){c.delayInProgress=true;J=setTimeout(function O(){J=null;F.hideTip(K);c.delayInProgress=false},N.closeDelay)}else{F.hideTip(K)}}}function I(){var Q=Math.abs(c.previousX-c.currentX),O=Math.abs(c.previousY-c.currentY),P=Q+O;if(P<N.intentSensitivity){F.showTip(K)}else{c.previousX=c.currentX;c.previousY=c.currentY;L()}}function M(){J=clearTimeout(J);c.delayInProgress=false}function H(){F.resetPosition(K)}this.show=L;this.hide=G;this.cancel=M;this.resetPosition=H}function j(){function G(M,L,J,O,P){var K=L.split("-")[0],N=new b(),I;if(q(M)){I=H(M,K)}else{I=F(M,K)}switch(L){case"n":N.set("left",I.left-(J/2));N.set("bottom",c.windowHeight-I.top+P);break;case"e":N.set("left",I.left+P);N.set("top",I.top-(O/2));break;case"s":N.set("left",I.left-(J/2));N.set("top",I.top+P);break;case"w":N.set("top",I.top-(O/2));N.set("right",c.windowWidth-I.left+P);break;case"nw":N.set("bottom",c.windowHeight-I.top+P);N.set("right",c.windowWidth-I.left-20);break;case"nw-alt":N.set("left",I.left);N.set("bottom",c.windowHeight-I.top+P);break;case"ne":N.set("left",I.left-20);N.set("bottom",c.windowHeight-I.top+P);break;case"ne-alt":N.set("bottom",c.windowHeight-I.top+P);N.set("right",c.windowWidth-I.left);break;case"sw":N.set("top",I.top+P);N.set("right",c.windowWidth-I.left-20);break;case"sw-alt":N.set("left",I.left);N.set("top",I.top+P);break;case"se":N.set("left",I.left-20);N.set("top",I.top+P);break;case"se-alt":N.set("top",I.top+P);N.set("right",c.windowWidth-I.left);break}return N}function F(K,J){var O=K.offset(),N=K.outerWidth(),I=K.outerHeight(),M,L;switch(J){case"n":M=O.left+N/2;L=O.top;break;case"e":M=O.left+N;L=O.top+I/2;break;case"s":M=O.left+N/2;L=O.top+I;break;case"w":M=O.left;L=O.top+I/2;break;case"nw":M=O.left;L=O.top;break;case"ne":M=O.left+N;L=O.top;break;case"sw":M=O.left;L=O.top+I;break;case"se":M=O.left+N;L=O.top+I;break}return{top:L,left:M}}function H(O,K){var S=O.closest("svg")[0],N=O[0],W=S.createSVGPoint(),L=N.getBBox(),V=N.getScreenCTM(),M=L.width/2,Q=L.height/2,P=[],I=["nw","n","ne","e","se","s","sw","w"],U,X,R,T;function J(){P.push(W.matrixTransform(V))}W.x=L.x;W.y=L.y;J();W.x+=M;J();W.x+=M;J();W.y+=Q;J();W.y+=Q;J();W.x-=M;J();W.x-=M;J();W.y-=Q;J();if(P[0].y!==P[1].y||P[0].x!==P[7].x){X=Math.atan2(V.b,V.a)*E;R=Math.ceil(((X%360)-22.5)/45);if(R<1){R+=8}while(R--){I.push(I.shift())}}for(T=0;T<P.length;T++){if(I[T]===K){U=P[T];break}}return{top:U.y+c.scrollTop,left:U.x+c.scrollLeft}}this.compute=G}function x(Q){var P=new j(),O=k("#"+Q.popupId);if(O.length===0){O=k("<div/>",{id:Q.popupId});if(w.length===0){w=k("body")}w.append(O)}if(Q.followMouse){if(!O.data(u)){A.on("mousemove",M);s.on("scroll",M);O.data(u,true)}}if(Q.mouseOnToPopup){O.on({mouseenter:function L(){if(O.data(f)){if(c.activeHover){c.activeHover.data(n).cancel()}}},mouseleave:function N(){if(c.activeHover){c.activeHover.data(n).hide()}}})}function I(S){S.data(e,true);O.queue(function R(T){H(S);T()})}function H(S){var U;if(!S.data(e)){return}if(c.isTipOpen){if(!c.isClosing){K(c.activeHover)}O.delay(100).queue(function R(V){H(S);V()});return}S.trigger("powerTipPreRender");U=B(S);if(U){O.empty().append(U)}else{return}S.trigger("powerTipRender");c.activeHover=S;c.isTipOpen=true;O.data(f,Q.mouseOnToPopup);if(!Q.followMouse){G(S);c.isFixedTipOpen=true}else{M()}O.fadeIn(Q.fadeInTime,function T(){if(!c.desyncTimeout){c.desyncTimeout=setInterval(J,500)}S.trigger("powerTipOpen")})}function K(R){c.isClosing=true;c.activeHover=null;c.isTipOpen=false;c.desyncTimeout=clearInterval(c.desyncTimeout);R.data(e,false);R.data(d,false);O.fadeOut(Q.fadeOutTime,function S(){var T=new b();c.isClosing=false;c.isFixedTipOpen=false;O.removeClass();T.set("top",c.currentY+Q.offset);T.set("left",c.currentX+Q.offset);O.css(T);R.trigger("powerTipClose")})}function M(){if(!c.isFixedTipOpen&&(c.isTipOpen||(c.tipOpenImminent&&O.data(u)))){var R=O.outerWidth(),V=O.outerHeight(),U=new b(),S,T;U.set("top",c.currentY+Q.offset);U.set("left",c.currentX+Q.offset);S=m(U,R,V);if(S!==p.none){T=a(S);if(T===1){if(S===p.right){U.set("left",c.windowWidth-R)}else{if(S===p.bottom){U.set("top",c.scrollTop+c.windowHeight-V)}}}else{U.set("left",c.currentX-R-Q.offset);U.set("top",c.currentY-V-Q.offset)}}O.css(U)}}function G(S){var R,T;if(Q.smartPlacement){R=k.fn.powerTip.smartPlacementLists[Q.placement];k.each(R,function(U,W){var V=m(F(S,W),O.outerWidth(),O.outerHeight());T=W;if(V===p.none){return false}})}else{F(S,Q.placement);T=Q.placement}O.addClass(T)}function F(U,T){var R=0,S,W,V=new b();V.set("top",0);V.set("left",0);O.css(V);do{S=O.outerWidth();W=O.outerHeight();V=P.compute(U,T,S,W,Q.offset);O.css(V)}while(++R<=5&&(S!==O.outerWidth()||W!==O.outerHeight()));return V}function J(){var R=false;if(c.isTipOpen&&!c.isClosing&&!c.delayInProgress){if(c.activeHover.data(e)===false||c.activeHover.is(":disabled")){R=true}else{if(!v(c.activeHover)&&!c.activeHover.is(":focus")&&!c.activeHover.data(d)){if(O.data(f)){if(!v(O)){R=true}}else{R=true}}}if(R){K(c.activeHover)}}}this.showTip=I;this.hideTip=K;this.resetPosition=G}function q(F){return window.SVGElement&&F[0] instanceof SVGElement}function h(){if(!c.mouseTrackingActive){c.mouseTrackingActive=true;k(function H(){c.scrollLeft=s.scrollLeft();c.scrollTop=s.scrollTop();c.windowWidth=s.width();c.windowHeight=s.height()});A.on("mousemove",i);s.on({resize:function G(){c.windowWidth=s.width();c.windowHeight=s.height()},scroll:function F(){var I=s.scrollLeft(),J=s.scrollTop();if(I!==c.scrollLeft){c.currentX+=I-c.scrollLeft;c.scrollLeft=I}if(J!==c.scrollTop){c.currentY+=J-c.scrollTop;c.scrollTop=J}}})}}function i(F){c.currentX=F.pageX;c.currentY=F.pageY}function v(F){var H=F.offset(),J=F[0].getBoundingClientRect(),I=J.right-J.left,G=J.bottom-J.top;return c.currentX>=H.left&&c.currentX<=H.left+I&&c.currentY>=H.top&&c.currentY<=H.top+G}function B(I){var G=I.data(y),F=I.data(o),K=I.data(l),H,J;if(G){if(k.isFunction(G)){G=G.call(I[0])}J=G}else{if(F){if(k.isFunction(F)){F=F.call(I[0])}if(F.length>0){J=F.clone(true,true)}}else{if(K){H=k("#"+K);if(H.length>0){J=H.html()}}}}return J}function m(M,L,K){var G=c.scrollTop,J=c.scrollLeft,I=G+c.windowHeight,F=J+c.windowWidth,H=p.none;if(M.top<G||Math.abs(M.bottom-c.windowHeight)-K<G){H|=p.top}if(M.top+K>I||Math.abs(M.bottom-c.windowHeight)>I){H|=p.bottom}if(M.left<J||M.right+L>F){H|=p.left}if(M.left+L>F||M.right<J){H|=p.right}return H}function a(G){var F=0;while(G){G&=G-1;F++}return F}}));
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/tabs.css
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/tabs.css	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/documentation/tabs.css	(revision 189)
@@ -0,0 +1,60 @@
+.tabs, .tabs2, .tabs3 {
+    background-image: url('tab_b.png');
+    width: 100%;
+    z-index: 101;
+    font-size: 13px;
+    font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif;
+}
+
+.tabs2 {
+    font-size: 10px;
+}
+.tabs3 {
+    font-size: 9px;
+}
+
+.tablist {
+    margin: 0;
+    padding: 0;
+    display: table;
+}
+
+.tablist li {
+    float: left;
+    display: table-cell;
+    background-image: url('tab_b.png');
+    line-height: 36px;
+    list-style: none;
+}
+
+.tablist a {
+    display: block;
+    padding: 0 20px;
+    font-weight: bold;
+    background-image:url('tab_s.png');
+    background-repeat:no-repeat;
+    background-position:right;
+    color: #283A5D;
+    text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
+    text-decoration: none;
+    outline: none;
+}
+
+.tabs3 .tablist a {
+    padding: 0 10px;
+}
+
+.tablist a:hover {
+    background-image: url('tab_h.png');
+    background-repeat:repeat-x;
+    color: #fff;
+    text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
+    text-decoration: none;
+}
+
+.tablist li.current a {
+    background-image: url('tab_a.png');
+    background-repeat:repeat-x;
+    color: #fff;
+    text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
+}
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/test/testBegin/testBegin.ino
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/test/testBegin/testBegin.ino	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/test/testBegin/testBegin.ino	(revision 189)
@@ -0,0 +1,88 @@
+#line 2 "testBegin.ino"
+/*
+  testWriteField unit test
+  
+  Unit Test for the writeField function in the ThingSpeak Communication Library for Arduino
+
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for prototyping
+  systems that collect, analyze, and react to their environments.
+  
+  This test use the ArduinoUnit 2.1.0 unit test framework.  Visit https://github.com/mmurdoch/arduinounit to learn more.
+  
+  Copyright 2015, The MathWorks, Inc.
+  
+  Documentation for the ThingSpeak Communication Library for Arduino is in the extras/documentation folder where the library was installed.
+  See the accompaning licence.txt file for licensing information.
+*/
+
+#include <ArduinoUnit.h>
+
+#ifdef ARDUINO_AVR_YUN
+  #include <SPI.h>
+  #include "YunClient.h"
+  YunClient client;
+#else
+  // Assume that we're using a wired Ethernet shield on a Mega
+  #include <SPI.h>
+  #include <Ethernet.h>
+  byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+  EthernetClient client;
+#endif
+
+#include <ThingSpeak.h>
+
+unsigned long testChannelNumber = 31461;
+const char * testChannelWriteAPIKey = "LD79EOAAWRVYF04Y";
+
+test(beginCase) 
+{
+  assertTrue(ThingSpeak.begin(client));
+
+  assertTrue(ThingSpeak.begin(client,IPAddress(1,2,3,4),80));
+
+  assertTrue(ThingSpeak.begin(client,"www.mathworks.com",80));
+}
+
+
+test(badAddresses) 
+{
+  // Test for valid, but incorrect, URL (en.wikipedia.org) that gives a 404 response
+  assertTrue(ThingSpeak.begin(client,"en.wikipedia.org",80));
+  assertEqual(ERR_BADURL, ThingSpeak.writeField(testChannelNumber, 1, (float)1.0, testChannelWriteAPIKey));
+  
+  // Test for non-existant URL (http://www.iwishthiswebsitewerereal.com/)
+  assertTrue(ThingSpeak.begin(client,"www.iwishthiswebsitewerereal.com",80));
+  #ifdef ARDUINO_AVR_YUN
+    // Yun gives -301 response
+    int badURLResponse = ERR_CONNECT_FAILED;
+  #else
+    // Ethernet shield gives -302 response
+    int badURLResponse = ERR_UNEXPECTED_FAIL;
+  #endif
+  assertEqual(badURLResponse, ThingSpeak.writeField(testChannelNumber, 1, (float)2.0, testChannelWriteAPIKey));
+
+  // Test for non-existant IP 192.168.1.234
+  assertTrue(ThingSpeak.begin(client,IPAddress(192,168,1,234),80));
+  assertEqual(-301, ThingSpeak.writeField(testChannelNumber, 1, (float)2.0, testChannelWriteAPIKey));
+
+  //Test for bad suburl (badapi.thingspeak.com)
+  assertTrue(ThingSpeak.begin(client,"invalid.thingspeak.com",80));
+  assertEqual(badURLResponse, ThingSpeak.writeField(testChannelNumber, 1, (float)4.0, testChannelWriteAPIKey));
+}
+
+void setup()
+{
+  Serial.begin(9600);
+  while(!Serial); // for the Arduino Leonardo/Micro only
+  #ifdef ARDUINO_AVR_YUN
+    Bridge.begin();
+  #else
+    Ethernet.begin(mac);
+  #endif
+}
+
+void loop()
+{
+  Test::run();
+}
+
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/test/testReadField/testReadField.ino
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/test/testReadField/testReadField.ino	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/test/testReadField/testReadField.ino	(revision 189)
@@ -0,0 +1,230 @@
+#line 2 "testReadField.ino"
+/*
+  testReadField unit test
+  
+  Unit Test for the readField function in the ThingSpeak Communication Library for Arduino
+
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for prototyping
+  systems that collect, analyze, and react to their environments.
+  
+  This test use the ArduinoUnit 2.1.0 unit test framework.  Visit https://github.com/mmurdoch/arduinounit to learn more.
+  
+  Copyright 2015, The MathWorks, Inc.
+  
+  Documentation for the ThingSpeak Communication Library for Arduino is in the extras/documentation folder where the library was installed.
+  See the accompaning licence.txt file for licensing information.
+*/
+
+#include <ArduinoUnit.h>
+#include <ThingSpeak.h>
+
+#ifdef ARDUINO_AVR_YUN
+  #include "YunClient.h"
+  YunClient client;
+#else
+  // Assume that we're using a wired Ethernet shield on a Mega
+  #include <SPI.h>
+  #include <Ethernet.h>
+  byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+  EthernetClient client;
+#endif
+
+unsigned long testPublicChannelNumber = 12397;
+unsigned long testPrivateChannelNumber = 31461;
+const char * testPrivateChannelReadAPIKey = "NKX4Z5JGO4M5I18A";
+const char * testPrivateChannelWriteAPIKey = "LD79EOAAWRVYF04Y";
+
+#define WRITE_DELAY_FOR_THINGSPEAK 15000
+
+test(readPublicFieldCase) 
+{
+  // Test basic value read -- should give anything but 0
+  assertNotEqual(0.0,ThingSpeak.readFloatField(testPublicChannelNumber, 4));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+
+  // Test read of field out of range
+  assertEqual(0.0,ThingSpeak.readFloatField(testPublicChannelNumber, 0));
+  assertEqual(ERR_INVALID_FIELD_NUM,ThingSpeak.getLastReadStatus());
+  assertEqual(0.0,ThingSpeak.readFloatField(testPublicChannelNumber, 9));
+  assertEqual(ERR_INVALID_FIELD_NUM,ThingSpeak.getLastReadStatus());
+
+  // Test read of invalid channel #
+  assertEqual(0.0,ThingSpeak.readFloatField(0, 1));
+  assertEqual(ERR_BADURL,ThingSpeak.getLastReadStatus());
+  assertEqual(0.0,ThingSpeak.readFloatField(4294967295L, 1));
+  assertEqual(ERR_BADURL,ThingSpeak.getLastReadStatus());
+}
+
+test(readPrivateFieldCase) 
+{
+  // Test basic value read -- should give anything but 0
+  assertNotEqual(0.0,ThingSpeak.readFloatField(testPrivateChannelNumber, 1, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+
+  // Test write with invalid API key
+  assertEqual(0.0,ThingSpeak.readFloatField(testPrivateChannelNumber, 1, "AFAKEAPIKEYFAKEX"));
+  // GECK 1235554:  Expect thingspeak to return 404 -- it returns 200.
+  //assertEqual(ERR_BADURL,ThingSpeak.getLastReadStatus());
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+}
+
+#ifdef ARDUINO_AVR_MEGA2560 // Only the mega has enough memory for all these tests
+test(ReadFloatFieldCase) 
+{
+  // Always to ensure that rate limit isn't hit
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  
+  assertEqual(OK_SUCCESS,ThingSpeak.setField(1,(float)3.14159));  // float
+  assertEqual(OK_SUCCESS,ThingSpeak.setField(2,-47)); // integer
+  assertEqual(OK_SUCCESS,ThingSpeak.setField(3,(long)100000L)); // long
+  assertEqual(OK_SUCCESS,ThingSpeak.setField(4,(float)NAN)); // Nan
+  assertEqual(OK_SUCCESS,ThingSpeak.setField(5,"foobar")); // string
+  assertEqual(OK_SUCCESS,ThingSpeak.setField(6,(float)INFINITY)); // + inf
+  assertEqual(OK_SUCCESS,ThingSpeak.setField(7,(float)-INFINITY)); // + inf
+  assertEqual(OK_SUCCESS,ThingSpeak.writeFields(testPrivateChannelNumber, testPrivateChannelWriteAPIKey)); // string
+
+  // Test read as float
+  assertLess(abs((float)3.14159 - ThingSpeak.readFloatField(testPrivateChannelNumber, 1, testPrivateChannelReadAPIKey)),float(0.001));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  assertEqual(-47.0,ThingSpeak.readFloatField(testPrivateChannelNumber, 2, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  assertEqual(100000.0,ThingSpeak.readFloatField(testPrivateChannelNumber, 3, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  assertTrue(isnan(ThingSpeak.readFloatField(testPrivateChannelNumber, 4, testPrivateChannelReadAPIKey)));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  assertEqual(0.0,ThingSpeak.readFloatField(testPrivateChannelNumber, 5, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  assertEqual(1,isinf(ThingSpeak.readFloatField(testPrivateChannelNumber, 6, testPrivateChannelReadAPIKey)));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  // AVR compiler doesn't correctly test for negative infinite (http://www.atmel.com/webdoc/AVRLibcReferenceManual/group__avr__math_1ga18a7409e0b2341afaa41993960961772.html)
+  assertEqual(1,isinf(ThingSpeak.readFloatField(testPrivateChannelNumber, 7, testPrivateChannelReadAPIKey)));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+}
+
+test(ReadIntFieldCase) 
+{
+  // Always wait 15 seconds to ensure that rate limit isn't hit
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  
+  ThingSpeak.setField(1,(float)3.14159);  // float
+  ThingSpeak.setField(2,-47); // integer
+  ThingSpeak.setField(3,(long)100000L); // long
+  ThingSpeak.setField(4,(float)NAN); // Nan
+  ThingSpeak.setField(5,"foobar"); // string
+  ThingSpeak.setField(6,(float)INFINITY); // + inf
+  ThingSpeak.setField(7,(float)-INFINITY); // + inf
+  assertEqual(OK_SUCCESS,ThingSpeak.writeFields(testPrivateChannelNumber, testPrivateChannelWriteAPIKey)); // string
+
+  // Test read as int
+  assertEqual(3,ThingSpeak.readIntField(testPrivateChannelNumber, 1, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  assertEqual(-47,ThingSpeak.readIntField(testPrivateChannelNumber, 2, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  // Out of range
+  assertEqual(-31072,ThingSpeak.readIntField(testPrivateChannelNumber, 3, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  // NAN
+  assertEqual(0,ThingSpeak.readIntField(testPrivateChannelNumber, 4, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  // Text
+  assertEqual(0,ThingSpeak.readIntField(testPrivateChannelNumber, 5, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  // INF
+  assertEqual(0,ThingSpeak.readIntField(testPrivateChannelNumber, 6, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  // -INF
+  assertEqual(0,ThingSpeak.readIntField(testPrivateChannelNumber, 7, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+}
+
+test(ReadLongFieldCase) 
+{
+  // Always wait 15 seconds to ensure that rate limit isn't hit
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  
+  ThingSpeak.setField(1,(float)3.14159);  // float
+  ThingSpeak.setField(2,-47); // integer
+  ThingSpeak.setField(3,(long)100000L); // long
+  ThingSpeak.setField(4,(float)NAN); // Nan
+  ThingSpeak.setField(5,"foobar"); // string
+  ThingSpeak.setField(6,(float)INFINITY); // + inf
+  ThingSpeak.setField(7,(float)-INFINITY); // + inf
+  assertEqual(OK_SUCCESS,ThingSpeak.writeFields(testPrivateChannelNumber, testPrivateChannelWriteAPIKey)); // string
+
+  // Test read as long
+  assertEqual(3L,ThingSpeak.readLongField(testPrivateChannelNumber, 1, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  assertEqual(-47L,ThingSpeak.readLongField(testPrivateChannelNumber, 2, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  // Out of range
+  assertEqual(100000L,ThingSpeak.readLongField(testPrivateChannelNumber, 3, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  // NAN
+  assertEqual(0L,ThingSpeak.readLongField(testPrivateChannelNumber, 4, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  // Text
+  assertEqual(0L,ThingSpeak.readLongField(testPrivateChannelNumber, 5, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  // INF
+  assertEqual(0L,ThingSpeak.readLongField(testPrivateChannelNumber, 6, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  // -INF
+  assertEqual(0L,ThingSpeak.readLongField(testPrivateChannelNumber, 7, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+}
+
+test(ReadStringFieldCase) 
+{
+  // Always wait 15 seconds to ensure that rate limit isn't hit
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  
+  ThingSpeak.setField(1,(float)3.14159);  // float
+  ThingSpeak.setField(2,-47); // integer
+  ThingSpeak.setField(3,(long)100000L); // long
+  ThingSpeak.setField(4,(float)NAN); // Nan
+  ThingSpeak.setField(5,"foobar"); // string
+  ThingSpeak.setField(6,(float)INFINITY); // + inf
+  ThingSpeak.setField(7,(float)-INFINITY); // + inf
+  assertEqual(OK_SUCCESS,ThingSpeak.writeFields(testPrivateChannelNumber, testPrivateChannelWriteAPIKey)); // string
+
+  // Test read as long
+  assertEqual(String("3.14159"),ThingSpeak.readStringField(testPrivateChannelNumber, 1, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+
+  assertEqual(String("-47"),ThingSpeak.readStringField(testPrivateChannelNumber, 2, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  // Out of range
+  assertEqual(String("100000"),ThingSpeak.readStringField(testPrivateChannelNumber, 3, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  // NAN
+  assertEqual(String("NAN"),ThingSpeak.readStringField(testPrivateChannelNumber, 4, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  // Text
+  assertEqual(String("foobar"),ThingSpeak.readStringField(testPrivateChannelNumber, 5, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  // INF
+  assertEqual(String("INF"),ThingSpeak.readStringField(testPrivateChannelNumber, 6, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+  // -INF
+  assertEqual(String("-INF"),ThingSpeak.readStringField(testPrivateChannelNumber, 7, testPrivateChannelReadAPIKey));
+  assertEqual(OK_SUCCESS,ThingSpeak.getLastReadStatus());
+}
+#endif // Mega only tests
+
+void setup()
+{
+  Serial.begin(9600);
+  while(!Serial); // for the Arduino Leonardo/Micro only
+  #ifdef ARDUINO_AVR_YUN
+    Bridge.begin();
+  #else
+    Ethernet.begin(mac);
+  #endif
+  ThingSpeak.begin(client);
+}
+
+void loop()
+{
+  Test::run();
+}
+
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/test/testSetField/testSetField.ino
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/test/testSetField/testSetField.ino	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/test/testSetField/testSetField.ino	(revision 189)
@@ -0,0 +1,189 @@
+#line 2 "testSetField.ino"
+/*
+  testSetField unit test
+  
+  Unit Test for the writeFields and setField functions in the ThingSpeak Communication Library for Arduino
+
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for prototyping
+  systems that collect, analyze, and react to their environments.
+  
+  This test use the ArduinoUnit 2.1.0 unit test framework.  Visit https://github.com/mmurdoch/arduinounit to learn more.
+  
+  Copyright 2015, The MathWorks, Inc.
+  
+  Documentation for the ThingSpeak Communication Library for Arduino is in the extras/documentation folder where the library was installed.
+  See the accompaning licence.txt file for licensing information.
+*/
+
+#include <ArduinoUnit.h>
+#include <ThingSpeak.h>
+
+#ifdef ARDUINO_AVR_YUN
+  #include "YunClient.h"
+  YunClient client;
+#else
+  // Assume that we're using a wired Ethernet shield on a Mega
+  #include <SPI.h>
+  #include <Ethernet.h>
+  byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+  EthernetClient client;
+#endif
+
+unsigned long testChannelNumber = 31461;
+const char * testChannelWriteAPIKey = "LD79EOAAWRVYF04Y";
+
+#define WRITE_DELAY_FOR_THINGSPEAK 15000
+
+test(setFieldCase) 
+{
+  // Always wait to ensure that rate limit isn't hit
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+
+  // No fields set
+  assertEqual(ERR_SETFIELD_NOT_CALLED, ThingSpeak.writeFields(testChannelNumber, testChannelWriteAPIKey));
+
+  // Test basic multi-field write
+  assertEqual(OK_SUCCESS,ThingSpeak.setField(1,(float)3.14159));  // float
+  assertEqual(OK_SUCCESS,ThingSpeak.setField(2,-47)); // integer
+  assertEqual(OK_SUCCESS,ThingSpeak.setField(3,(long)100000L)); // long
+  assertEqual(OK_SUCCESS,ThingSpeak.setField(4,(float)NAN)); // Nan
+  assertEqual(OK_SUCCESS,ThingSpeak.setField(5,"foobar")); // string
+  assertEqual(OK_SUCCESS,ThingSpeak.setField(6,(float)INFINITY)); // + inf
+  assertEqual(OK_SUCCESS,ThingSpeak.setField(7,(float)-INFINITY)); // + inf
+  assertEqual(OK_SUCCESS,ThingSpeak.writeFields(testChannelNumber, testChannelWriteAPIKey));
+
+  // Test write when not enough time has elapsed
+  assertEqual(OK_SUCCESS,ThingSpeak.setField(1,(float)3.14159));  // float
+  assertEqual(ERR_NOT_INSERTED,ThingSpeak.writeFields(testChannelNumber, testChannelWriteAPIKey));
+
+  // Allow enough time to pass to make sure that it would work 
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+
+  // Test write to field out of range
+  assertEqual(ERR_INVALID_FIELD_NUM,ThingSpeak.setField(0,(float)3.14159)); 
+  assertEqual(ERR_INVALID_FIELD_NUM,ThingSpeak.setField(9,(float)3.14159)); 
+}
+
+#ifdef ARDUINO_AVR_MEGA2560 // Only the mega has enough memory for all these tests
+test(setFieldFloatCase) 
+{
+  // Always wait to ensure that rate limit isn't hit
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+
+  // Test max range values
+  assertEqual(OK_SUCCESS, ThingSpeak.setField(1, (float)-999999000000));
+  assertEqual(OK_SUCCESS, ThingSpeak.setField(2, (float)999999000000));
+  
+  // Test high precision values
+  assertEqual(OK_SUCCESS, ThingSpeak.setField(3, (float)3.14159));
+  assertEqual(OK_SUCCESS, ThingSpeak.setField(4, (float)-3.14159));
+  
+  // Test passing NaN and Inf
+  assertEqual(OK_SUCCESS, ThingSpeak.setField(5, (float)NAN));
+  assertEqual(OK_SUCCESS, ThingSpeak.setField(6, (float)INFINITY));
+  assertEqual(OK_SUCCESS, ThingSpeak.setField(7, (float)-INFINITY));
+  
+  // Test out of range values
+  assertEqual(ERR_OUT_OF_RANGE, ThingSpeak.setField(8, (float)-1000000000000.0));
+  assertEqual(ERR_OUT_OF_RANGE, ThingSpeak.setField(8, (float)1000000000000.0));
+  
+  assertEqual(OK_SUCCESS,ThingSpeak.writeFields(testChannelNumber, testChannelWriteAPIKey));
+}
+
+test(setFieldIntCase) 
+{
+  // Always wait to ensure that rate limit isn't hit
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+
+  // Test max range values
+  assertEqual(OK_SUCCESS, ThingSpeak.setField(1, (int)-32768));
+  assertEqual(OK_SUCCESS, ThingSpeak.setField(2, (int)32767));
+  
+  assertEqual(OK_SUCCESS,ThingSpeak.writeFields(testChannelNumber, testChannelWriteAPIKey));
+}
+
+test(setFieldLongCase) 
+{
+  // Always wait to ensure that rate limit isn't hit
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+
+  // Test max range values
+  assertEqual(OK_SUCCESS, ThingSpeak.setField(1, (long)-2147483648L));
+  assertEqual(OK_SUCCESS, ThingSpeak.setField(2, (long)2147483647L));
+  
+  assertEqual(OK_SUCCESS,ThingSpeak.writeFields(testChannelNumber, testChannelWriteAPIKey)); 
+}
+
+test(setFieldCharStarCase) 
+{
+  // Always wait to ensure that rate limit isn't hit
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+
+  // Test empty string
+  assertEqual(OK_SUCCESS, ThingSpeak.setField(1, ""));
+
+  char longString[300];
+
+  // Test max string
+  memset(longString, '0',255);
+  longString[255] = 0;
+  assertEqual(OK_SUCCESS, ThingSpeak.setField(2, longString));
+
+  // Test long string
+  memset(longString, '0',sizeof(longString)/sizeof(longString[0]) - 1);
+  longString[sizeof(longString)] = 0;
+ 
+  assertEqual(ERR_OUT_OF_RANGE, ThingSpeak.setField(3, longString));
+  
+  assertEqual(OK_SUCCESS,ThingSpeak.writeFields(testChannelNumber, testChannelWriteAPIKey));
+}
+
+test(setFieldStringCase) 
+{
+  // Always wait to ensure that rate limit isn't hit
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+
+  // Test empty string
+  assertEqual(OK_SUCCESS, ThingSpeak.setField(1, String()));
+
+  unsigned int numChar = 300;
+  String longString;
+  longString.reserve(numChar);
+
+  // Test max string
+  for(unsigned int i = 0; i < 255; i++)
+  {
+    longString += '0';
+  }
+  assertEqual(OK_SUCCESS, ThingSpeak.setField(2, longString));
+
+  // Test long string
+  longString.reserve(numChar);
+  for(unsigned int i = 0; i < numChar; i++)
+  {
+    longString += '0';
+  }
+  
+  assertEqual(ERR_OUT_OF_RANGE, ThingSpeak.setField(3, longString));
+  
+  assertEqual(OK_SUCCESS,ThingSpeak.writeFields(testChannelNumber, testChannelWriteAPIKey));
+}
+#endif // Mega only tests
+
+void setup()
+{
+  Serial.begin(9600);
+  while(!Serial); // for the Arduino Leonardo/Micro only
+  #ifdef ARDUINO_AVR_YUN
+    Bridge.begin();
+  #else
+    Ethernet.begin(mac);
+  #endif
+  ThingSpeak.begin(client);
+}
+
+void loop()
+{
+  Test::run();
+}
+
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/test/testWriteField/testWriteField.ino
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/test/testWriteField/testWriteField.ino	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/extras/test/testWriteField/testWriteField.ino	(revision 189)
@@ -0,0 +1,208 @@
+#line 2 "testWriteField.ino"
+/*
+  testWriteField unit test
+  
+  Unit Test for the writeField function in the ThingSpeak Communication Library for Arduino
+
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for prototyping
+  systems that collect, analyze, and react to their environments.
+  
+  This test use the ArduinoUnit 2.1.0 unit test framework.  Visit https://github.com/mmurdoch/arduinounit to learn more.
+  
+  Copyright 2015, The MathWorks, Inc.
+  
+  Documentation for the ThingSpeak Communication Library for Arduino is in the extras/documentation folder where the library was installed.
+  See the accompaning licence.txt file for licensing information.
+*/
+
+#include <ArduinoUnit.h>
+#include <ThingSpeak.h>
+
+#ifdef ARDUINO_AVR_YUN
+  #include "YunClient.h"
+  YunClient client;
+#else
+  // Assume that we're using a wired Ethernet shield on a Mega
+  #include <SPI.h>
+  #include <Ethernet.h>
+  byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+  EthernetClient client;
+#endif
+
+unsigned long testChannelNumber = 31461;
+const char * testChannelWriteAPIKey = "LD79EOAAWRVYF04Y";
+
+#define WRITE_DELAY_FOR_THINGSPEAK 15000
+
+test(writeFieldCase) 
+{
+  // Always wait to ensure that rate limit isn't hit
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+
+  // Test basic value write
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, (float)1.0, testChannelWriteAPIKey));
+
+  // Test write when not enough time has elapsed
+  assertEqual(ERR_NOT_INSERTED, ThingSpeak.writeField(testChannelNumber, 1, (float)1.0, testChannelWriteAPIKey));
+
+  // Allow enough time to pass to make sure that it would work 
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+
+  // Test write to field out of range
+  assertEqual(ERR_INVALID_FIELD_NUM, ThingSpeak.writeField(testChannelNumber, 0, (float)1.0, testChannelWriteAPIKey));
+  assertEqual(ERR_INVALID_FIELD_NUM, ThingSpeak.writeField(testChannelNumber, 9, (float)1.0, testChannelWriteAPIKey));
+
+  // Test write to invalid channel #
+  // ThingSpeak accepts this, since it only uses the API key to write.  The Channel number is ignored.
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(0, 1, (float)1.0, testChannelWriteAPIKey));
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(4294967295L, 1, (float)1.0, testChannelWriteAPIKey));
+ 
+  // Test write with invalid API key
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(ERR_BADAPIKEY, ThingSpeak.writeField(testChannelNumber, 1, (float)1.0, "AFAKEAPIKEYFAKEX"));
+}
+
+test(writeFieldFloatCase) 
+{
+  // Always wait to ensure that rate limit isn't hit
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+
+  // Test float write
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, (float)1.0, testChannelWriteAPIKey));
+
+  // Test max range values
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, (float)-999999000000, testChannelWriteAPIKey));
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, (float)999999000000, testChannelWriteAPIKey));
+  
+  // Test high precision values
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, (float)3.14159, testChannelWriteAPIKey));
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, (float)-3.14159, testChannelWriteAPIKey));
+  
+  // Test passing NaN and Inf
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, (float)NAN, testChannelWriteAPIKey));
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, (float)INFINITY, testChannelWriteAPIKey));
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, (float)-INFINITY, testChannelWriteAPIKey));
+  
+  // Test out of range values
+  assertEqual(ERR_OUT_OF_RANGE, ThingSpeak.writeField(testChannelNumber, 1, (float)-1000000000000.0, testChannelWriteAPIKey));
+  assertEqual(ERR_OUT_OF_RANGE, ThingSpeak.writeField(testChannelNumber, 1, (float)1000000000000.0, testChannelWriteAPIKey));
+}
+
+#ifdef ARDUINO_AVR_MEGA2560 // Only the mega has enough memory for all these tests
+test(writeFieldIntCase) 
+{
+  // Always wait to ensure that rate limit isn't hit
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+
+  // Test int write
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, (int)1, testChannelWriteAPIKey));
+
+  // Test max range values
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, (int)-32768, testChannelWriteAPIKey));
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, (int)32767, testChannelWriteAPIKey));
+}
+
+test(writeFieldLongCase) 
+{
+  // Always wait to ensure that rate limit isn't hit
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+
+  // Test long write
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, 1000000L, testChannelWriteAPIKey));
+
+  // Test max range values
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, (long)-2147483648L, testChannelWriteAPIKey));
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, (long)2147483647L, testChannelWriteAPIKey));
+}
+
+test(writeFieldCharStarCase) 
+{
+  // Always wait to ensure that rate limit isn't hit
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+
+  // Test char * write
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, "The Rain in Spain", testChannelWriteAPIKey));
+
+  // Test empty string
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, "", testChannelWriteAPIKey));
+
+  char longString[300];
+
+  // Test max string
+  memset(longString, '0',255);
+  longString[255] = 0;
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, longString, testChannelWriteAPIKey));
+
+  // Test long string
+  memset(longString, '0',sizeof(longString)/sizeof(longString[0]) - 1);
+  longString[sizeof(longString)] = 0;
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(ERR_OUT_OF_RANGE, ThingSpeak.writeField(testChannelNumber, 1, longString, testChannelWriteAPIKey));
+}
+
+test(writeFieldStringCase) 
+{
+  // Always wait to ensure that rate limit isn't hit
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+
+  // Test String write
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, String("The Rain in Spain"), testChannelWriteAPIKey));
+
+  // Test empty string
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, String(), testChannelWriteAPIKey));
+
+  unsigned int numChar = 300;
+  String longString;
+  longString.reserve(numChar);
+
+  // Test max string
+  for(unsigned int i = 0; i < 255; i++)
+  {
+    longString += '0';
+  }
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(OK_SUCCESS, ThingSpeak.writeField(testChannelNumber, 1, longString, testChannelWriteAPIKey));
+
+  // Test long string
+  longString.reserve(numChar);
+  for(unsigned int i = 0; i < numChar; i++)
+  {
+    longString += '0';
+  }
+  delay(WRITE_DELAY_FOR_THINGSPEAK);
+  assertEqual(ERR_OUT_OF_RANGE, ThingSpeak.writeField(testChannelNumber, 1, longString, testChannelWriteAPIKey));
+}
+#endif // Mega only tests
+
+void setup()
+{
+  Serial.begin(9600);
+  while(!Serial); // for the Arduino Leonardo/Micro only
+  #ifdef ARDUINO_AVR_YUN
+    Bridge.begin();
+  #else
+    Ethernet.begin(mac);
+  #endif
+  ThingSpeak.begin(client);
+}
+
+void loop()
+{
+  Test::run();
+}
+
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/keywords.txt
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/keywords.txt	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/keywords.txt	(revision 189)
@@ -0,0 +1,15 @@
+ThingSpeak	KEYWORD1
+begin	KEYWORD2
+writeField	KEYWORD2
+setField	KEYWORD2
+setLatitude	KEYWORD2
+setLongitude	KEYWORD2
+setElevation	KEYWORD2
+writeRaw	KEYWORD2
+writeFields	KEYWORD2
+readFloatField	KEYWORD2
+readIntField	KEYWORD2
+readLongField	KEYWORD2
+readStringField	KEYWORD2
+readRaw	KEYWORD2
+getLastReadStatus	KEYWORD2
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/library.json
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/library.json	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/library.json	(revision 189)
@@ -0,0 +1,25 @@
+{
+  "name": "ThingSpeak",
+  "keywords": "iot",
+  "description": "ThingSpeak Communication Library for Arduino & ESP8266",
+  "authors":
+  {
+	  "name": "MathWorks",
+	  "email": "thingspeak@mathworks.com",
+	  "url": "https://www.thingspeak.com/",
+	  "maintainer": true
+  },
+  "repository":
+  {
+    "type": "git",
+    "url": "https://github.com/mathworks/thingspeak-arduino.git"
+  },
+  "version": "1.1.1",
+  "examples": [
+    "examples/*/*.ino"
+  ],
+  "url": "https://www.thingspeak.com/",
+  "exclude": "extras",
+  "frameworks": "arduino",
+  "platforms": "*"
+}
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/library.properties
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/library.properties	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/library.properties	(revision 189)
@@ -0,0 +1,9 @@
+name=ThingSpeak
+version=1.1.1
+author=MathWorks <thingspeak@mathworks.com>
+maintainer=MathWorks <thingspeak@mathworks.com>
+sentence=ThingSpeak Communication Library for Arduino & ESP8266
+paragraph=ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building systems that collect, analyze, and react to their environments.
+category=Communication
+url=https://www.thingspeak.com/
+architectures=avr,esp8266
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/license.md
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/license.md	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/license.md	(revision 189)
@@ -0,0 +1,12 @@
+Copyright :copyright: 2015, The MathWorks, Inc.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+4. In all cases, the software is, and all modifications and derivatives of the software shall be, licensed to you solely for use in conjunction with MathWorks products and service offerings.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/src/ThingSpeak.cpp
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/src/ThingSpeak.cpp	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/src/ThingSpeak.cpp	(revision 189)
@@ -0,0 +1,13 @@
+/*
+  ThingSpeak Communication Library For Arduino
+  
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  
+  Copyright 2015, The MathWorks, Inc.
+ 
+  See the accompaning licence file for licensing information.
+*/
+
+#include "ThingSpeak.h"
+ThingSpeakClass ThingSpeak;
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/src/ThingSpeak.h
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/src/ThingSpeak.h	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/src/ThingSpeak.h	(revision 189)
@@ -0,0 +1,1516 @@
+/*
+  ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+
+  Enables an Arduino 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. 
+
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  
+  Copyright 2016, The MathWorks, Inc.
+ 
+  See the accompaning licence file for licensing information.
+*/
+
+/**
+  @mainpage
+ * 
+ * \ref ThingSpeakClass "For technical documentation, visit this page"
+ * 
+ * ThingSpeak offers free data storage and analysis of time-stamped numeric or alphanumeric data.
+ * Users can access ThingSpeak by visiting http://thingspeak.com and creating a ThingSpeak user account.
+ *
+ * ThingSpeak stores data in channels.  Channels support an unlimited number of timestamped observations (think of these as rows in a spreadsheet).  
+ * Each channel has up to 8 fields (think of these as columns in a speadsheet).  Check out this <a href="http://www.mathworks.com/videos/introduction-to-thingspeak-107749.html">video</a> for an overview.
+ * 
+ * Channels may be public, where anyone can see the data, or private, where only the owner and select users can read the data.
+ * Each channel has an associated Write API Key that is used to control who can write to a channel.  
+ * In addition, private channels have one or more Read API Keys to control who can read from private channel.  
+ * An API Key is not required to read from public channels.  Each channel can have up to 8 fields. One field is created by default.
+ *
+ * You can visualize and do online analytics of your data on ThingSpeak using the built in version of MATLAB, or use the desktop version of MATLAB to get
+ * deeper historical insight.  Visit https://www.mathworks.com/hardware-support/thingspeak.html to learn more.
+ * 
+ * <h3>Compatible Hardware</h3>
+ * * <a href="http://www.arduino.cc">Arduino</a> or compatible using a wired or Wi-Fi ethernet shield (we have tested with <a href="http://www.arduino.cc/en/Main/ArduinoBoardUno">Uno</a> and <a href="http://www.arduino.cc/en/Main/ArduinoBoardMega2560">Mega</a>), should work with Arduino WiFi Shield 101
+ * * <a href="http://www.arduino.cc/en/Main/ArduinoBoardYun">Arduino Yun</a> running OpenWRT-Yun Release 1.5.3 (November 13th, 2014) or later.  There are known issues with earlier versions.  Visit [this page](http://www.arduino.cc/en/Main/Software) to get the latest version.
+ * * ESP8266 (tested with <a href="https://www.sparkfun.com/products/13711">SparkFun ESP8266 Thing - Dev Board</a> and <a href="http://www.seeedstudio.com/depot/NodeMCU-v2-Lua-based-ESP8266-development-kit-p-2415.html">NodeMCU 1.0 module</a>)
+ * * Particle (Formally Spark) Core, <a href="https://www.particle.io/prototype#photon">Photon</a>, and <a href="https://www.particle.io/prototype#electron">Electron</a>
+ * 
+ * <h3>Examples</h3>
+ * The library includes several examples to help you get started.  These are accessible in the Examples/ThingSpeak menu off the File menu in the Arduino IDE.
+ * * <b>CheerLights:</b> Reads the latest <a href="http://www.cheerlights.com">CheerLights</a> color on ThingSpeak, and sets an RGB LED.
+ * * <b>ReadLastTemperature:</b> Reads the latest temperature from the public <a href="https://thingspeak.com/channels/12397">MathWorks weather station</a> in Natick, MA on ThingSpeak.
+ * * <b>ReadPrivateChannel:</b> Reads the latest voltage value from a private channel on ThingSpeak.
+ * * <b>ReadWeatherStation:</b> Reads the latest weather data from the public <a href="https://thingspeak.com/channels/12397">MathWorks weather station</a> in Natick, MA on ThingSpeak.
+ * * <b>WriteMultipleVoltages:</b> Reads analog voltages from pins 0-7 and writes them to the 8 fields of a channel on ThingSpeak.
+ * * <b>WriteVoltage:</b> Reads an analog voltage from pin 0, converts to a voltage, and writes it to a channel on ThingSpeak.
+ */
+
+#ifndef ThingSpeak_h
+#define ThingSpeak_h
+
+//#define PRINT_DEBUG_MESSAGES
+//#define PRINT_HTTP
+
+#ifdef ARDUINO_ARCH_SAMD
+#define ARDUINO_ARCH_AVR
+#include "avr/dtostrf.h"
+#endif /* ARDUINO_ARCH_SAMD */
+
+#ifdef SPARK
+    // Create platform defines for Particle devices
+    #if PLATFORM_ID == 6
+        #define PARTICLE_PHOTON
+        #define PARTICLE_PHOTONELECTRON
+    #elif PLATFORM_ID == 10
+        #define PARTICLE_ELECTRON
+        #define PARTICLE_PHOTONELECTRON
+    #elif PLATFORM_ID == 0
+        #define PARTICLE_CORE
+    #endif
+
+    #include "math.h"
+    #include "application.h"
+    #ifdef PARTICLE_PHOTONELECTRON
+        extern char* dtoa(double val, unsigned char prec, char *sout);
+        // On spark photon, There is no itoa, so map to ltoa.
+        #include "string_convert.h"
+        #define itoa ltoa
+    #else
+        // On spark core, a long and an int are equivalent, and so there's no "ltoa" function defined.  Map it to itoa.
+        extern char * itoa(int a, char* buffer, unsigned char radix);
+        #define ltoa itoa
+        extern char *dtostrf (double val, signed char width, unsigned char prec, char *sout);
+    #endif
+#else
+	#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266)
+	  #include "Arduino.h"
+	  #include <Client.h>
+	#else
+      #error Only Arduino Yun, Uno/Mega/Due with either Wired or wi-fi Ethernet shield, ESP8266, and Spark Core/Photon/Electron are supported.
+	#endif
+#endif
+
+#define THINGSPEAK_URL "api.thingspeak.com"
+#define THINGSPEAK_IPADDRESS IPAddress(184,106,153,149)
+#define THINGSPEAK_PORT_NUMBER 80
+
+#ifdef ARDUINO_ARCH_AVR
+    #ifdef ARDUINO_AVR_YUN
+        #define TS_USER_AGENT "tslib-arduino/1.0 (arduino yun)"
+    #else
+        #define TS_USER_AGENT "tslib-arduino/1.0 (arduino uno or mega)"
+    #endif
+#elif defined(ARDUINO_ARCH_ESP8266)
+    #define TS_USER_AGENT "tslib-arduino/1.0 (ESP8266)"
+#elif defined(SPARK)
+    #ifdef PARTICLE_CORE
+        #define TS_USER_AGENT "tslib-arduino/1.0 (particle core)"
+    #elif defined(PARTICLE_PHOTON)
+        #define TS_USER_AGENT "tslib-arduino/1.0 (particle photon)"
+    #elif defined(PARTICLE_ELECTRON)
+        #define TS_USER_AGENT "tslib-arduino/1.0 (particle electron)"
+    #endif
+    #define SPARK_PUBLISH_TTL 60 // Spark "time to live" for published messages
+    #define SPARK_PUBLISH_TOPIC "thingspeak-debug"
+#endif
+
+#define FIELDNUM_MIN 1
+#define FIELDNUM_MAX 8
+#define FIELDLENGTH_MAX 255  // Max length for a field in ThingSpeak is 255 bytes (UTF-8)
+
+#define TIMEOUT_MS_SERVERRESPONSE 5000  // Wait up to five seconds for server to respond
+
+#define OK_SUCCESS              200     // OK / Success
+#define ERR_BADAPIKEY           400     // Incorrect API key (or invalid ThingSpeak server address)
+#define ERR_BADURL              404     // Incorrect API key (or invalid ThingSpeak server address)
+#define ERR_OUT_OF_RANGE        -101    // Value is out of range or string is too long (> 255 bytes)
+#define ERR_INVALID_FIELD_NUM   -201    // Invalid field number specified
+#define ERR_SETFIELD_NOT_CALLED -210    // setField() was not called before writeFields()
+#define ERR_CONNECT_FAILED      -301    // Failed to connect to ThingSpeak
+#define ERR_UNEXPECTED_FAIL     -302    // Unexpected failure during write to ThingSpeak
+#define ERR_BAD_RESPONSE        -303    // Unable to parse response
+#define ERR_TIMEOUT             -304    // Timeout waiting for server to respond
+#define ERR_NOT_INSERTED        -401    // Point was not inserted (most probable cause is the rate limit of once every 15 seconds)
+
+/**
+ * @brief 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. 
+ */
+class ThingSpeakClass
+{
+  public:
+	ThingSpeakClass()
+	{
+		resetWriteFields();
+	    this->lastReadStatus = OK_SUCCESS;
+        this->customIP = INADDR_NONE;
+        this->port = THINGSPEAK_PORT_NUMBER;        
+	};
+
+	/**
+	 * @brief Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak.
+	 * @param client EthernetClient, YunClient, TCPClient, or WiFiClient created earlier in the sketch
+	 * @param customHostName Host name of a custom install of ThingSpeak
+	 * @param port Port number to use with a custom install of ThingSpeak
+	 * @return Always returns true
+     * @comment This does not validate the information passed in, or generate any calls to ThingSpeak.
+	 * @code
+		#include <SPI.h>
+		#include <Ethernet.h>
+		byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+		EthernetClient client;
+
+		#include "ThingSpeak.h"
+
+		void setup() {
+		  Ethernet.begin(mac);
+		  ThingSpeak.begin(client,"api.thingspeak.com", 80);
+		}
+	 * @endcode
+	 */
+    bool begin(Client & client, const char * customHostName, unsigned int port)
+	{
+#ifdef PRINT_DEBUG_MESSAGES
+		Serial.print("ts::tsBegin    (client: Client URL: "); Serial.print(customHostName); Serial.println(")");
+#endif
+	this->setClient(&client);
+	this->setServer(customHostName, port);
+	resetWriteFields();
+	this->lastReadStatus = OK_SUCCESS;
+	return true;
+	};
+
+	/**
+	 * @brief Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak.
+	 * @param client EthernetClient, YunClient, TCPClient, or WiFiClient created earlier in the sketch
+	 * @param customIP IP address of a custom install of ThingSpeak
+	 * @param port Port number to use with a custom install of ThingSpeak
+	 * @return Always returns true
+     * @comment This does not validate the information passed in, or generate any calls to ThingSpeak.
+	 * @code
+		#include <SPI.h>
+		#include <Ethernet.h>
+		byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+		EthernetClient client;
+
+		#include "ThingSpeak.h"
+
+		void setup() {
+		  Ethernet.begin(mac);
+		  ThingSpeak.begin(client,IPAddress(184,106,153,149), 80);
+		}
+	 * @endcode
+	 */
+	bool begin(Client & client, IPAddress customIP, unsigned int port)
+	{
+#ifdef PRINT_DEBUG_MESSAGES
+		Serial.print("ts::tsBegin    (client: Client IP: "); Serial.print(customIP); Serial.println(")");
+#endif
+		this->setClient(&client);
+		this->setServer(customIP, port);
+		resetWriteFields();
+		this->lastReadStatus = OK_SUCCESS;
+		return true;
+	};
+
+	/**
+	 * @brief Initializes the ThingSpeak library and network settings using the ThingSpeak.com service.
+	 * @param client EthernetClient, YunClient, TCPClient, or WiFiClient created earlier in the sketch
+	 * @return Always returns true
+     * @comment This does not validate the information passed in, or generate any calls to ThingSpeak.
+	 * @code
+		#include <SPI.h>
+		#include <Ethernet.h>
+		byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+		EthernetClient client;
+
+		#include "ThingSpeak.h"
+
+		void setup() {
+		  Ethernet.begin(mac);
+		  ThingSpeak.begin(client);
+		}
+	 * @endcode
+	 */
+	bool begin(Client & client)
+	{
+#ifdef PRINT_DEBUG_MESSAGES
+		Serial.print("ts::tsBegin");
+#endif
+		this->setClient(&client);
+		this->setServer();
+		resetWriteFields();
+		this->lastReadStatus = OK_SUCCESS;
+		return true;
+	};
+	
+	/**
+	 * @brief Write an integer value to a single field in a ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to write to.
+	 * @param value Integer value (from -32,768 to 32,767) to write.
+	 * @param writeAPIKey Write API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @remark Visit https://thingspeak.com/docs/channels for more information about channels, API keys, and fields.  ThingSpeak limits the number of writes to a channel to once every 15 seconds.
+	 * @code
+		void loop() {
+			int sensorValue = analogRead(A0);
+			ThingSpeak.writeField(myChannelNumber, 1, sensorValue, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int writeField(unsigned long channelNumber, unsigned int field, int value, const char * writeAPIKey)
+	{
+#ifdef SPARK
+        // On Spark, int and long are the same, so map to the long version
+        return writeField(channelNumber, field, (long)value, writeAPIKey);
+#else
+		char valueString[10];  // int range is -32768 to 32768, so 7 bytes including terminator, plus a little extra
+        itoa(value, valueString, 10);
+		return writeField(channelNumber, field, valueString, writeAPIKey);
+#endif
+	};
+
+	/**
+	 * @brief Write a long value to a single field in a ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to write to.
+	 * @param value Long value (from -2,147,483,648 to 2,147,483,647) to write.
+	 * @param writeAPIKey Write API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @remark Visit https://thingspeak.com/docs/channels for more information about channels, API keys, and fields.  ThingSpeak limits the number of writes to a channel to once every 15 seconds.
+	 * @code
+		void loop() {
+			int sensorValue = analogRead(A0);
+			ThingSpeak.writeField(myChannelNumber, 1, sensorValue, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int writeField(unsigned long channelNumber, unsigned int field, long value, const char * writeAPIKey)
+	{
+		char valueString[15];  // long range is -2147483648 to 2147483647, so 12 bytes including terminator
+   		ltoa(value, valueString, 10);
+		return writeField(channelNumber, field, valueString, writeAPIKey);
+	};
+
+	/**
+	 * @brief Write a floating point value to a single field in a ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to write to.
+	 * @param value Floating point value (from -999999000000 to 999999000000) to write.  If you need more accuracy, or a wider range, you should format the number using <tt>dtostrf</tt> and writeField().
+	 * @param writeAPIKey Write API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @remark Visit https://thingspeak.com/docs/channels for more information about channels, API keys, and fields.  ThingSpeak limits the number of writes to a channel to once every 15 seconds.
+	 * @code
+		void loop() {
+			int sensorValue = analogRead(A0);
+			float voltage = sensorValue * (5.0 / 1023.0);
+			ThingSpeak.writeField(myChannelNumber, 1, voltage, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int writeField(unsigned long channelNumber, unsigned int field, float value, const char * writeAPIKey)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::writeField (channelNumber: "); Serial.print(channelNumber); Serial.print(" writeAPIKey: "); Serial.print(writeAPIKey); Serial.print(" field: "); Serial.print(field); Serial.print(" value: "); Serial.print(value,5); Serial.println(")");
+		#endif
+		char valueString[20]; // range is -999999000000.00000 to 999999000000.00000, so 19 + 1 for the terminator
+		int status = convertFloatToChar(value, valueString);
+		if(status != OK_SUCCESS) return status;
+
+		return writeField(channelNumber, field, valueString, writeAPIKey);
+	};
+
+	/**
+	 * @brief Write a string to a single field in a ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to write to.
+	 * @param value String to write (UTF8 string).  ThingSpeak limits this field to 255 bytes.
+	 * @param writeAPIKey Write API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @remark Visit https://thingspeak.com/docs/channels for more information about channels, API keys, and fields.  ThingSpeak limits the number of writes to a channel to once every 15 seconds.
+	 * @code
+		void loop() {
+			int sensorValue = analogRead(A0);
+			if (sensorValue > 512) {
+				ThingSpeak.writeField(myChannelNumber, 1, "High", myWriteAPIKey);
+			}
+			else {
+				ThingSpeak.writeField(myChannelNumber, 1, "Low", myWriteAPIKey);
+			}
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int writeField(unsigned long channelNumber, unsigned int field, const char * value, const char * writeAPIKey)
+	{
+		return writeField(channelNumber, field, String(value), writeAPIKey);
+	};
+
+	/**
+	 * @brief Write a String to a single field in a ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to write to.
+	 * @param value Character array (zero terminated) to write (UTF8).  ThingSpeak limits this field to 255 bytes.
+	 * @param writeAPIKey Write API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @remark Visit https://thingspeak.com/docs/channels for more information about channels, API keys, and fields.  ThingSpeak limits the number of writes to a channel to once every 15 seconds.
+	 * @code
+		void loop() {
+			int sensorValue = analogRead(A0);
+			String meaning;
+			if (sensorValue < 400) {
+				meaning = String("Too Cold!");
+			} else if (sensorValue > 600) {
+				meaning = String("Too Hot!");
+			} else {
+				meaning = String("Just Right");
+			}
+			ThingSpeak.writeField(myChannelNumber, 1, meaning, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int writeField(unsigned long channelNumber, unsigned int field, String value, const char * writeAPIKey)
+	{
+		// Invalid field number specified
+		if(field < FIELDNUM_MIN || field > FIELDNUM_MAX) return ERR_INVALID_FIELD_NUM;
+		// Max # bytes for ThingSpeak field is 255
+		if(value.length() > FIELDLENGTH_MAX) return ERR_OUT_OF_RANGE;
+		
+		#ifdef PRINT_DEBUG_MESSAGES
+		  #ifdef SPARK
+            Particle.publish(SPARK_PUBLISH_TOPIC, "writeField (" + String(channelNumber) + ", " + String(writeAPIKey) + ", " + String(field) + ", " + String(value) + ")", SPARK_PUBLISH_TTL, PRIVATE);
+          #else
+			Serial.print("ts::writeField (channelNumber: "); Serial.print(channelNumber); Serial.print(" writeAPIKey: "); Serial.print(writeAPIKey); Serial.print(" field: "); Serial.print(field); Serial.print(" value: \""); Serial.print(value); Serial.println("\")");
+		  #endif
+		#endif
+		String postMessage = String("field") + String(field) + "=" + value;
+		return writeRaw(channelNumber, postMessage, writeAPIKey);
+ 	};
+
+    
+	/**
+	 * @brief Set the value of a single field that will be part of a multi-field update.
+	 * To write multiple fields at once, call setField() for each of the fields you want to write, and then call writeFields()
+	 * @param field Field number (1-8) within the channel to set
+	 * @param value Integer value (from -32,768 to 32,767) to set.
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setLatitude(), setLongitude(), setElevation(), writeFields()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int setField(unsigned int field, int value)
+	{
+#ifdef SPARK
+        // On Spark, int and long are the same, so map to the long version
+        return setField(field, (long)value);
+#else
+		char valueString[10];  // int range is -32768 to 32768, so 7 bytes including terminator
+	    itoa(value, valueString, 10);
+		
+		return setField(field, valueString);
+#endif
+	};
+
+	/**
+	 * @brief Set the value of a single field that will be part of a multi-field update.
+	 * To write multiple fields at once, call setField() for each of the fields you want to write, and then call writeFields()
+	 * @param field Field number (1-8) within the channel to set
+	 * @param value Long value (from -2,147,483,648 to 2,147,483,647) to write.
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setLatitude(), setLongitude(), setElevation(), writeFields()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int setField(unsigned int field, long value)
+	{
+		char valueString[15];  // long range is -2147483648 to 2147483647, so 12 bytes including terminator
+	    ltoa(value, valueString, 10);
+		return setField(field, valueString);
+	};
+
+
+	/**
+	 * @brief Set the value of a single field that will be part of a multi-field update.
+	 * To write multiple fields at once, call setField() for each of the fields you want to write, and then call writeFields()
+	 * @param field Field number (1-8) within the channel to set
+	 * @param value Floating point value (from -999999000000 to 999999000000) to write.  If you need more accuracy, or a wider range, you should format the number yourself (using <tt>dtostrf</tt>) and setField() using the resulting string.
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setLatitude(), setLongitude(), setElevation(), writeFields()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+    int setField(unsigned int field, float value)
+	{
+		char valueString[20]; // range is -999999000000.00000 to 999999000000.00000, so 19 + 1 for the terminator
+		int status = convertFloatToChar(value, valueString);
+		if(status != OK_SUCCESS) return status;
+
+		return setField(field, valueString);
+	};
+
+	/**
+	 * @brief Set the value of a single field that will be part of a multi-field update.
+	 * To write multiple fields at once, call setField() for each of the fields you want to write, and then call writeFields()
+	 * @param field Field number (1-8) within the channel to set
+	 * @param value String to write (UTF8).  ThingSpeak limits this to 255 bytes.  
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setLatitude(), setLongitude(), setElevation(), writeFields()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+    int setField(unsigned int field, const char * value)
+	{
+		return setField(field, String(value));
+	};
+
+	/**
+	 * @brief Set the value of a single field that will be part of a multi-field update.
+	 * To write multiple fields at once, call setField() for each of the fields you want to write, and then call writeFields()
+	 * @param field Field number (1-8) within the channel to set
+	 * @param value String to write (UTF8).  ThingSpeak limits this to 255 bytes.
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setLatitude(), setLongitude(), setElevation(), writeFields()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+    int setField(unsigned int field, String value)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+		  #ifdef SPARK
+            Particle.publish(SPARK_PUBLISH_TOPIC, "setField " + String(field) + " to " + String(value), SPARK_PUBLISH_TTL, PRIVATE);
+          #else
+			Serial.print("ts::setField   (field: "); Serial.print(field); Serial.print(" value: \""); Serial.print(value); Serial.println("\")");
+		  #endif
+		#endif
+		if(field < FIELDNUM_MIN || field > FIELDNUM_MAX) return ERR_INVALID_FIELD_NUM;
+		// Max # bytes for ThingSpeak field is 255 (UTF-8)
+		if(value.length() > FIELDLENGTH_MAX) return ERR_OUT_OF_RANGE;
+		this->nextWriteField[field - 1] = value;
+		return OK_SUCCESS;
+	};
+
+
+	/**
+	 * @brief Set the latitude of a multi-field update.
+	 * To record latitude, longitude and elevation of a write, call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields()
+	 * @param latitude Latitude of the measurement (degrees N, use negative values for degrees S)
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setField(), setLongitude(), setElevation(), writeFields()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			setLatitude(42.2833);
+			setLongitude(-71.3500);
+			setElevation(100);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int setLatitude(float latitude)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::setLatitude(latitude: "); Serial.print(latitude,3); Serial.println("\")");
+		#endif
+		this->nextWriteLatitude = latitude;
+		return OK_SUCCESS;
+	};
+
+
+	/**
+	 * @brief Set the longitude of a multi-field update.
+	 * To record latitude, longitude and elevation of a write, call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields()
+	 * @param longitude Longitude of the measurement (degrees E, use negative values for degrees W)
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setField(), setLatitude(), setElevation(), writeFields()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			setLatitude(42.2833);
+			setLongitude(-71.3500);
+			setElevation(100);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int setLongitude(float longitude)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::setLongitude(longitude: "); Serial.print(longitude,3); Serial.println("\")");
+		#endif
+		this->nextWriteLongitude = longitude;
+		return OK_SUCCESS;
+	};
+
+
+	/**
+	 * @brief Set the elevation of a multi-field update.
+	 * To record latitude, longitude and elevation of a write, call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields()
+	 * @param elevation Elevation of the measurement (meters above sea level)
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setField(), setLatitude(), setLongitude(), writeFields()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			setLatitude(42.2833);
+			setLongitude(-71.3500);
+			setElevation(100);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int setElevation(float elevation)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::setElevation(elevation: "); Serial.print(elevation,3); Serial.println("\")");
+		#endif
+		this->nextWriteElevation = elevation;
+		return OK_SUCCESS;
+	};
+
+
+	/**
+	 * @brief Write a multi-field update.
+	 * Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields()
+	 * @param channelNumber Channel number
+	 * @param writeAPIKey Write API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setField(), setLatitude(), setLongitude(), setElevation()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			setLatitude(42.2833);
+			setLongitude(-71.3500);
+			setElevation(100);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int writeFields(unsigned long channelNumber, const char * writeAPIKey)
+	{
+		String postMessage = String("");
+		bool fFirstItem = true;
+		for(size_t iField = 0; iField < 8; iField++)
+		{
+			if(this->nextWriteField[iField].length() > 0)
+			{
+				if(!fFirstItem)
+				{
+					postMessage = postMessage + String("&");
+				}
+				postMessage = postMessage + String("field") + String(iField + 1) + String("=") + this->nextWriteField[iField];
+				fFirstItem = false;
+				this->nextWriteField[iField] = "";
+			}
+		}
+
+		if(!isnan(nextWriteLatitude))
+		{
+			if(!fFirstItem)
+			{
+				postMessage = postMessage + String("&");
+			}
+			postMessage = postMessage + String("lat=") + String(this->nextWriteLatitude);
+			fFirstItem = false;
+			this->nextWriteLatitude = NAN;
+		}
+
+		if(!isnan(this->nextWriteLongitude))
+		{
+			if(!fFirstItem)
+			{
+				postMessage = postMessage + String("&");
+			}
+			postMessage = postMessage + String("long=") + String(this->nextWriteLongitude);
+			fFirstItem = false;
+			this->nextWriteLongitude = NAN;
+		}
+
+
+		if(!isnan(this->nextWriteElevation))
+		{
+			if(!fFirstItem)
+			{
+				postMessage = postMessage + String("&");
+			}
+			postMessage = postMessage + String("elevation=") + String(this->nextWriteElevation);
+			fFirstItem = false;
+			this->nextWriteElevation = NAN;
+		}
+
+		if(fFirstItem)
+		{
+			// setField was not called before writeFields
+			return ERR_SETFIELD_NOT_CALLED;
+		}
+
+		return writeRaw(channelNumber, postMessage, writeAPIKey);
+	};
+
+
+	/**
+	 * @brief Write a raw POST to a ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param postMessage Raw URL to write to ThingSpeak as a string.  See the documentation at https://thingspeak.com/docs/channels#update_feed.
+	 * @param writeAPIKey Write API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @remark This is low level functionality that will not be required by most users.
+	 * @code
+		void loop() {
+			const char postMessage[] = "field1=23&created_at=2014-12-31%2023:59:59";
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int writeRaw(unsigned long channelNumber, const char * postMessage, const char * writeAPIKey)
+	{
+		return writeRaw(channelNumber, String(postMessage), writeAPIKey);
+	};
+
+
+	/**
+	 * @brief Write a raw POST to a ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param postMessage Raw URL to write to ThingSpeak as a String.  See the documentation at https://thingspeak.com/docs/channels#update_feed.
+	 * @param writeAPIKey Write API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @remark This is low level functionality that will not be required by most users.
+	 * @code
+		void loop() {
+			String postMessage = String("field1=23&created_at=2014-12-31%2023:59:59");
+			ThingSpeak.writeRaw(myChannelNumber, postMessage, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int writeRaw(unsigned long channelNumber, String postMessage, const char * writeAPIKey)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::writeRaw   (channelNumber: "); Serial.print(channelNumber); Serial.print(" writeAPIKey: "); Serial.print(writeAPIKey); Serial.print(" postMessage: \""); Serial.print(postMessage); Serial.println("\")");
+		#endif
+
+		if(!connectThingSpeak())
+		{
+			// Failed to connect to ThingSpeak
+			return ERR_CONNECT_FAILED;
+		}
+
+		postMessage = postMessage + String("&headers=false");
+
+		#ifdef PRINT_DEBUG_MESSAGES
+		  #ifdef SPARK
+            Particle.publish(SPARK_PUBLISH_TOPIC, "Post " + postMessage, SPARK_PUBLISH_TTL, PRIVATE);
+          #else
+			Serial.print("               POST \"");Serial.print(postMessage);Serial.println("\"");
+		  #endif
+		#endif
+
+		postMessage = postMessage + String("\n");
+
+		// Post data to thingspeak
+		if(!this->client->print("POST /update HTTP/1.1\n")) return abortWriteRaw();
+		if(!writeHTTPHeader(writeAPIKey)) return abortWriteRaw();
+		if(!this->client->print("Content-Type: application/x-www-form-urlencoded\n")) return abortWriteRaw();
+		if(!this->client->print("Content-Length: ")) return abortWriteRaw();
+		if(!this->client->print(postMessage.length())) return abortWriteRaw();
+		if(!this->client->print("\n\n")) return abortWriteRaw();
+		if(!this->client->print(postMessage)) return abortWriteRaw();
+  
+		String entryIDText = String();
+		int status = getHTTPResponse(entryIDText);
+		if(status != OK_SUCCESS)
+		{
+			client->stop();
+			return status;
+		}
+		long entryID = entryIDText.toInt();
+
+		#ifdef PRINT_DEBUG_MESSAGES
+		Serial.print("               Entry ID \"");Serial.print(entryIDText);Serial.print("\" (");Serial.print(entryID);Serial.println(")");
+		#endif
+
+		client->stop();
+		
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.println("disconnected.");
+		#endif
+		if(entryID == 0)
+		{
+			// ThingSpeak did not accept the write
+			status = ERR_NOT_INSERTED;
+		}
+		return status;
+	};
+	
+	/**
+	 * @brief Read the latest string from a private ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to read from.
+	 * @param readAPIKey Read API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return Value read (UTF8 string), or empty string if there is an error.  Use getLastReadStatus() to get more specific information.
+	 * @code
+		void loop() {
+		  String message = ThingSpeak.readStringField(myChannelNumber, 1, myReadAPIKey);
+		  Serial.print("Latest message is: "); 
+		  Serial.println(message);
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+    String readStringField(unsigned long channelNumber, unsigned int field, const char * readAPIKey)
+	{
+		if(field < FIELDNUM_MIN || field > FIELDNUM_MAX)
+		{
+			this->lastReadStatus = ERR_INVALID_FIELD_NUM;
+			return("");
+		}
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::readStringField(channelNumber: "); Serial.print(channelNumber); 
+			if(NULL != readAPIKey)
+			{
+				Serial.print(" readAPIKey: "); Serial.print(readAPIKey);
+			}
+			Serial.print(" field: "); Serial.print(field); Serial.println(")");
+		#endif
+		return readRaw(channelNumber, String(String("/fields/") + String(field) + String("/last")), readAPIKey);
+	}
+
+
+	/**
+	 * @brief Read the latest string from a public ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to read from.
+	 * @return Value read (UTF8), or empty string if there is an error.  Use getLastReadStatus() to get more specific information.
+	 * @code
+		void loop() {
+		  String message = ThingSpeak.readStringField(myChannelNumber, 1);
+		  Serial.print("Latest message is: "); 
+		  Serial.println(message);
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+	String readStringField(unsigned long channelNumber, unsigned int field)
+	{
+		return readStringField(channelNumber, field, NULL);
+	};
+
+
+	/**
+	 * @brief Read the latest float from a private ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to read from.
+	 * @param readAPIKey Read API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return Value read, or 0 if the field is text or there is an error.  Use getLastReadStatus() to get more specific information.  Note that NAN, INFINITY, and -INFINITY are valid results.
+	 * @code
+		void loop() {
+		  float voltage = ThingSpeak.readFloatField(myChannelNumber, 1, myReadAPIKey);
+		  Serial.print("Latest voltage is: "); 
+		  Serial.print(voltage);
+		  Serial.println("V"); 
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+    float readFloatField(unsigned long channelNumber, unsigned int field, const char * readAPIKey)
+	{
+		return convertStringToFloat(readStringField(channelNumber, field, readAPIKey));
+	};
+
+
+	/**
+	 * @brief Read the latest float from a public ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to read from.
+	 * @return Value read, or 0 if the field is text or there is an error.  Use getLastReadStatus() to get more specific information.  Note that NAN, INFINITY, and -INFINITY are valid results.
+	 * @code
+		void loop() {
+		  float voltage = ThingSpeak.readFloatField(myChannelNumber, 1);
+		  Serial.print("Latest voltage is: "); 
+		  Serial.print(voltage);
+		  Serial.println("V"); 
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+    float readFloatField(unsigned long channelNumber, unsigned int field)
+	{
+		return readFloatField(channelNumber, field, NULL);
+	};
+
+
+	/**
+	 * @brief Read the latest long from a private ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to read from.
+	 * @param readAPIKey Read API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return Value read, or 0 if the field is text or there is an error.  Use getLastReadStatus() to get more specific information.
+	 * @code
+		void loop() {
+		  long value = ThingSpeak.readLongField(myChannelNumber, 1, myReadAPIKey);
+		  Serial.print("Latest value is: "); 
+		  Serial.print(value);
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+    long readLongField(unsigned long channelNumber, unsigned int field, const char * readAPIKey)
+	{
+        // Note that although the function is called "toInt" it really returns a long.
+		return readStringField(channelNumber, field, readAPIKey).toInt();
+	}
+
+
+	/**
+	 * @brief Read the latest long from a public ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to read from.
+	 * @return Value read, or 0 if the field is text or there is an error.  Use getLastReadStatus() to get more specific information.
+	 * @code
+		void loop() {
+		  long value = ThingSpeak.readLongField(myChannelNumber, 1);
+		  Serial.print("Latest value is: "); 
+		  Serial.print(value);
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+	long readLongField(unsigned long channelNumber, unsigned int field)
+	{
+		return readLongField(channelNumber, field, NULL);
+	};
+
+
+	/**
+	 * @brief Read the latest int from a private ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to read from.
+	 * @param readAPIKey Read API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return Value read, or 0 if the field is text or there is an error.  Use getLastReadStatus() to get more specific information.
+	 * @remark If the value returned is out of range for an int, the result is undefined.
+	 * @code
+		void loop() {
+		  int value = ThingSpeak.readIntField(myChannelNumber, 1, myReadAPIKey);
+		  Serial.print("Latest value is: "); 
+		  Serial.print(value);
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+    int readIntField(unsigned long channelNumber, unsigned int field, const char * readAPIKey)
+	{
+		return readLongField(channelNumber, field, readAPIKey);
+	}
+
+
+	/**
+	 * @brief Read the latest int from a public ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to read from.
+	 * @return Value read, or 0 if the field is text or there is an error.  Use getLastReadStatus() to get more specific information.
+	 * @remark If the value returned is out of range for an int, the result is undefined.
+	 * @code
+		void loop() {
+		  int value = ThingSpeak.readIntField(myChannelNumber, 1);
+		  Serial.print("Latest value is: "); 
+		  Serial.print(value);
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+    int readIntField(unsigned long channelNumber, unsigned int field)
+	{
+		return readLongField(channelNumber, field, NULL);
+	};
+	
+	/**
+	 * @brief Read a raw response from a public ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param URLSuffix Raw URL to write to ThingSpeak as a String.  See the documentation at https://thingspeak.com/docs/channels#get_feed
+	 * @return Response if successful, or empty string.	 Use getLastReadStatus() to get more specific information.
+	 * @remark This is low level functionality that will not be required by most users.
+	 * @code
+		void loop() {
+		  String response = ThingSpeak.readRaw(myChannelNumber, String("feeds/days=1"));
+		  Serial.print("Response: "); 
+		  Serial.print(response);
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+	String readRaw(unsigned long channelNumber, String URLSuffix)
+	{
+		return readRaw(channelNumber, URLSuffix, NULL);
+	}
+	
+	/**
+	 * @brief Read a raw response from a private ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param URLSuffix Raw URL to write to ThingSpeak as a String.  See the documentation at https://thingspeak.com/docs/channels#get_feed
+	 * @param readAPIKey Read API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return Response if successful, or empty string.	 Use getLastReadStatus() to get more specific information.
+	 * @remark This is low level functionality that will not be required by most users.
+	 * @code
+		void loop() {
+		  String response = ThingSpeak.readRaw(myChannelNumber, String("feeds/days=1"), myReadAPIKey);
+		  Serial.print("Response: "); 
+		  Serial.print(response);
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+	String readRaw(unsigned long channelNumber, String URLSuffix, const char * readAPIKey)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::readRaw   (channelNumber: "); Serial.print(channelNumber);
+			if(NULL != readAPIKey)
+			{
+				Serial.print(" readAPIKey: "); Serial.print(readAPIKey);
+			}
+			Serial.print(" URLSuffix: \""); Serial.print(URLSuffix); Serial.println("\")");
+		#endif
+
+		if(!connectThingSpeak())
+		{
+			this->lastReadStatus = ERR_CONNECT_FAILED;
+			return String("");
+		}
+
+		String URL = String("/channels/") + String(channelNumber) + URLSuffix;
+
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("               GET \"");Serial.print(URL);Serial.println("\"");
+		#endif
+
+		// Post data to thingspeak
+		if(!this->client->print("GET ")) return abortReadRaw();
+		if(!this->client->print(URL)) return abortReadRaw();
+		if(!this->client->print(" HTTP/1.1\n")) return abortReadRaw();
+		if(!writeHTTPHeader(readAPIKey)) return abortReadRaw();
+		if(!this->client->print("\n")) return abortReadRaw();
+ 
+		String content = String();
+		int status = getHTTPResponse(content);
+		this->lastReadStatus = status;
+
+
+		#ifdef PRINT_DEBUG_MESSAGES
+			if(status == OK_SUCCESS)
+			{
+				Serial.print("Read: \""); Serial.print(content); Serial.println("\"");
+			}
+		#endif
+
+		client->stop();
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.println("disconnected.");
+		#endif
+
+		if(status != OK_SUCCESS)
+		{
+			// return status;
+			return String("");
+		}
+
+        // This is a workaround to a bug in the Spark implementation of String
+    	return String("") + content;
+	};
+	
+	/**
+	 * @brief Get the status of the previous read.
+	 * @return Generally, these are HTTP status codes.  Negative values indicate an error generated by the library.
+	 * Possible response codes:
+	 *  * 200: OK / Success
+	 *  * 404: Incorrect API key (or invalid ThingSpeak server address)
+	 *  * -101: Value is out of range or string is too long (> 255 characters)
+	 *  * -201: Invalid field number specified
+	 *  * -210: setField() was not called before writeFields()
+	 *  * -301: Failed to connect to ThingSpeak
+	 *  * -302: Unexpected failure during write to ThingSpeak
+	 *  * -303: Unable to parse response
+     *  * -304: Timeout waiting for server to respond
+	 *  * -401: Point was not inserted (most probable cause is the rate limit of once every 15 seconds)
+	 * @remark The read functions will return zero or empty if there is an error.  Use this function to retrieve the details.
+	 * @code
+		void loop() {
+		  String message = ThingSpeak.readStringField(myChannelNumber, 1);
+		  int resultCode = ThingSpeak.getLastReadStatus();
+		  if(resultCode == 200)
+		  {
+			  Serial.print("Latest message is: "); 
+			  Serial.println(message);
+		  }
+		  else
+		  {
+			  Serial.print("Error reading message.  Status was: "); 
+			  Serial.println(resultCode);
+		  }
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+	int getLastReadStatus()
+	{
+		return this->lastReadStatus;
+	};
+private:
+
+    int abortWriteRaw()
+    {
+        this->client->stop();
+        return ERR_UNEXPECTED_FAIL;
+    }
+
+    String abortReadRaw()
+    {
+		this->client->stop();
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.println("ReadRaw abort - disconnected.");
+		#endif
+		this->lastReadStatus = ERR_UNEXPECTED_FAIL;
+		return String("");
+    }
+
+	void setServer(const char * customHostName, unsigned int port)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::setServer  (URL: \""); Serial.print(customHostName); Serial.println("\")");
+		#endif
+		this->customIP = INADDR_NONE;
+		this->customHostName = customHostName;
+        this->port = port;
+	};
+
+	void setServer(IPAddress customIP, unsigned int port)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::setServer  (IP: \""); Serial.print(customIP); Serial.println("\")");
+		#endif
+		this->customIP = customIP;
+		this->customHostName = NULL;
+        this->port = port;
+	};
+
+	void setServer()
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::setServer  (default)");
+		#endif
+		this->customIP = INADDR_NONE;
+		this->customHostName = NULL;
+        this->port = THINGSPEAK_PORT_NUMBER;
+	};
+
+	void setClient(Client * client) {this->client = client;};
+
+	Client * client = NULL;
+	const char * customHostName = NULL;
+	IPAddress customIP;
+    unsigned int port;
+	String nextWriteField[8];
+	float nextWriteLatitude;
+	float nextWriteLongitude;
+	float nextWriteElevation;
+	int lastReadStatus;
+
+	bool connectThingSpeak()
+	{
+		bool connectSuccess = false;
+		if(this->customIP == INADDR_NONE && NULL == this->customHostName)
+        {
+ 			#ifdef PRINT_DEBUG_MESSAGES
+  			    Serial.print("               Connect to default ThingSpeak URL...");
+			#endif
+			connectSuccess = client->connect(THINGSPEAK_URL,THINGSPEAK_PORT_NUMBER);
+            if(!connectSuccess)
+            {
+ 			    #ifdef PRINT_DEBUG_MESSAGES
+  			        Serial.print("Failed. Try default IP...");
+			    #endif
+			    connectSuccess = client->connect(THINGSPEAK_IPADDRESS,THINGSPEAK_PORT_NUMBER);
+            }
+       }
+       else
+       {
+		    if(!(this->customIP == INADDR_NONE))
+		    {
+			    // Connect to the server on port 80 (HTTP) at the customIP address
+			    #ifdef PRINT_DEBUG_MESSAGES
+  			      Serial.print("               Connect to ");Serial.print(this->customIP);Serial.print("...");
+			    #endif
+			    connectSuccess = client->connect(this->customIP,this->port);
+		    }
+		    if(NULL != this->customHostName)
+		    {
+			    // Connect to the server on port 80 (HTTP) at the URL address
+			    #ifdef PRINT_DEBUG_MESSAGES
+    		      #ifdef SPARK
+                    Particle.publish(SPARK_PUBLISH_TOPIC, "Attempt Connect to URL " + String(this->customHostName), SPARK_PUBLISH_TTL, PRIVATE);
+                  #else
+				    Serial.print("               Connect to ");Serial.print(this->customHostName);Serial.print(" ...");
+			      #endif
+			    #endif
+			    connectSuccess = client->connect(customHostName,this->port);
+		    }
+        }
+
+		#ifdef PRINT_DEBUG_MESSAGES
+		if (connectSuccess)
+		{
+    	    #ifdef SPARK
+              Particle.publish(SPARK_PUBLISH_TOPIC, "Connection Success", SPARK_PUBLISH_TTL, PRIVATE);
+            #else
+		      Serial.println("Success.");
+		    #endif
+		}
+		else
+		{
+    	    #ifdef SPARK
+              Particle.publish(SPARK_PUBLISH_TOPIC, "Connection Failure", SPARK_PUBLISH_TTL, PRIVATE);
+            #else
+  			  Serial.println("Failed.");
+  			#endif
+		}
+		#endif
+		return connectSuccess;
+	};
+
+	bool writeHTTPHeader(const char * APIKey)
+	{
+        if(NULL != this->customHostName)
+        {
+		    if (!this->client->print("Host: ")) return false;
+		    if (!this->client->print(this->customHostName)) return false;
+		    if (!this->client->print("\n")) return false;
+        }
+        else
+        {
+		    if (!this->client->print("Host: api.thingspeak.com\n")) return false;
+        }
+		if (!this->client->print("Connection: close\n")) return false;
+		if (!this->client->print("User-Agent: ")) return false;
+		if (!this->client->print(TS_USER_AGENT)) return false;
+		if (!this->client->print("\n")) return false;
+		if(NULL != APIKey)
+		{
+			if (!this->client->print("X-THINGSPEAKAPIKEY: ")) return false;
+			if (!this->client->print(APIKey)) return false;
+			if (!this->client->print("\n")) return false;
+		}
+		return true;
+	};
+
+	int getHTTPResponse(String & response)
+	{
+        long startWaitForResponseAt = millis();
+        while(client->available() == 0 && millis() - startWaitForResponseAt < TIMEOUT_MS_SERVERRESPONSE)
+        {
+            delay(100);
+        }
+        if(client->available() == 0)
+        {
+			return ERR_TIMEOUT; // Didn't get server response in time
+        }
+
+		if(!client->find(const_cast<char *>("HTTP/1.1")))
+		{
+			#ifdef PRINT_HTTP
+                #ifdef SPARK
+                    Particle.publish(SPARK_PUBLISH_TOPIC, "ERROR: Didn't find HTTP/1.1", SPARK_PUBLISH_TTL, PRIVATE);
+                #else
+    				Serial.println("ERROR: Didn't find HTTP/1.1");
+    			#endif
+    		#endif
+			return ERR_BAD_RESPONSE; // Couldn't parse response (didn't find HTTP/1.1)
+		}
+		int status = client->parseInt();
+		#ifdef PRINT_HTTP
+            #ifdef SPARK
+                Particle.publish(SPARK_PUBLISH_TOPIC, "Got Status of " + String(status), SPARK_PUBLISH_TTL, PRIVATE);
+            #else
+    			Serial.print("Got Status of ");Serial.println(status);
+    		#endif
+		#endif
+		if(status != OK_SUCCESS)
+		{
+			return status;
+		}
+
+		if(!client->find(const_cast<char *>("\r\n")))
+		{
+			#ifdef PRINT_HTTP
+                #ifdef SPARK
+                    Particle.publish(SPARK_PUBLISH_TOPIC, "ERROR: Didn't find end of status line", SPARK_PUBLISH_TTL, PRIVATE);
+                #else
+    				Serial.println("ERROR: Didn't find end of status line");
+    			#endif
+			#endif
+			return ERR_BAD_RESPONSE;
+		}
+		#ifdef PRINT_HTTP
+            #ifdef SPARK
+                Particle.publish(SPARK_PUBLISH_TOPIC, "Found end of status line", SPARK_PUBLISH_TTL, PRIVATE);
+            #else
+    			Serial.println("Found end of status line");
+    	    #endif
+		#endif
+
+		if(!client->find(const_cast<char *>("\n\r\n")))
+		{
+			#ifdef PRINT_HTTP
+                #ifdef SPARK
+                    Particle.publish(SPARK_PUBLISH_TOPIC, "ERROR: Didn't find end of header", SPARK_PUBLISH_TTL, PRIVATE);
+                #else
+    				Serial.println("ERROR: Didn't find end of header");
+    			#endif
+			#endif
+			return ERR_BAD_RESPONSE;
+		}
+		#ifdef PRINT_HTTP
+            #ifdef SPARK
+                Particle.publish(SPARK_PUBLISH_TOPIC, "Found end of header", SPARK_PUBLISH_TTL, PRIVATE);
+            #else
+			    Serial.println("Found end of header");
+			#endif
+		#endif
+		// This is a workaround to a bug in the Spark implementation of String
+		String tempString = client->readStringUntil('\r');
+		response = tempString;
+		#ifdef PRINT_HTTP
+            #ifdef SPARK
+                Particle.publish(SPARK_PUBLISH_TOPIC, "Response: \"" + tempString + "\"", SPARK_PUBLISH_TTL, PRIVATE);
+            #else
+    			Serial.print("Response: \"");Serial.print(response);Serial.println("\"");
+			#endif
+		#endif
+		return status;
+	};
+
+	int convertFloatToChar(float value, char *valueString)
+	{
+		// Supported range is -999999000000 to 999999000000
+		if(0 == isinf(value) && (value > 999999000000 || value < -999999000000))
+		{
+			// Out of range
+			return ERR_OUT_OF_RANGE;
+		}
+		// Given that the resolution of Spark is 1 / 2^12, or ~0.00024 volts, assume that 5 places right of decimal should be sufficient for most applications
+        #ifdef PARTICLE_PHOTONELECTRON
+          //Photon doesn't have a dtostrf, but does have dtoa
+          dtoa((double)value,5, valueString);
+        #else
+		  dtostrf(value,1,5, valueString);
+        #endif
+		return OK_SUCCESS;
+	};
+
+	float convertStringToFloat(String value)
+	{
+		// There's a bug in the AVR function strtod that it doesn't decode -INF correctly (it maps it to INF)
+		float result = value.toFloat();
+		if(1 == isinf(result) && *value.c_str() == '-')
+		{
+			result = (float)-INFINITY;
+		}
+		return result;
+	};
+
+	void resetWriteFields()
+	{
+		for(size_t iField = 0; iField < 8; iField++)
+		{
+			this->nextWriteField[iField] = "";
+		}
+		this->nextWriteLatitude = NAN;
+		this->nextWriteLongitude = NAN;
+		this->nextWriteElevation = NAN;
+	};
+};
+
+extern ThingSpeakClass ThingSpeak;
+
+#endif //ThingSpeak_h
Index: rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/src/ThingSpeak_org.h
===================================================================
--- rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/src/ThingSpeak_org.h	(revision 189)
+++ rtos_arduino/trunk/arduino_lib/libraries/thingspeak-arduino/src/ThingSpeak_org.h	(revision 189)
@@ -0,0 +1,1509 @@
+/*
+  ThingSpeak(TM) Communication Library For Arduino, ESP8266, and Particle
+
+  Enables an Arduino 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. 
+
+  ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
+  systems that collect, analyze, and react to their environments.
+  
+  Copyright 2016, The MathWorks, Inc.
+ 
+  See the accompaning licence file for licensing information.
+*/
+
+/**
+  @mainpage
+ * 
+ * \ref ThingSpeakClass "For technical documentation, visit this page"
+ * 
+ * ThingSpeak offers free data storage and analysis of time-stamped numeric or alphanumeric data.
+ * Users can access ThingSpeak by visiting http://thingspeak.com and creating a ThingSpeak user account.
+ *
+ * ThingSpeak stores data in channels.  Channels support an unlimited number of timestamped observations (think of these as rows in a spreadsheet).  
+ * Each channel has up to 8 fields (think of these as columns in a speadsheet).  Check out this <a href="http://www.mathworks.com/videos/introduction-to-thingspeak-107749.html">video</a> for an overview.
+ * 
+ * Channels may be public, where anyone can see the data, or private, where only the owner and select users can read the data.
+ * Each channel has an associated Write API Key that is used to control who can write to a channel.  
+ * In addition, private channels have one or more Read API Keys to control who can read from private channel.  
+ * An API Key is not required to read from public channels.  Each channel can have up to 8 fields. One field is created by default.
+ *
+ * You can visualize and do online analytics of your data on ThingSpeak using the built in version of MATLAB, or use the desktop version of MATLAB to get
+ * deeper historical insight.  Visit https://www.mathworks.com/hardware-support/thingspeak.html to learn more.
+ * 
+ * <h3>Compatible Hardware</h3>
+ * * <a href="http://www.arduino.cc">Arduino</a> or compatible using a wired or Wi-Fi ethernet shield (we have tested with <a href="http://www.arduino.cc/en/Main/ArduinoBoardUno">Uno</a> and <a href="http://www.arduino.cc/en/Main/ArduinoBoardMega2560">Mega</a>), should work with Arduino WiFi Shield 101
+ * * <a href="http://www.arduino.cc/en/Main/ArduinoBoardYun">Arduino Yun</a> running OpenWRT-Yun Release 1.5.3 (November 13th, 2014) or later.  There are known issues with earlier versions.  Visit [this page](http://www.arduino.cc/en/Main/Software) to get the latest version.
+ * * ESP8266 (tested with <a href="https://www.sparkfun.com/products/13711">SparkFun ESP8266 Thing - Dev Board</a> and <a href="http://www.seeedstudio.com/depot/NodeMCU-v2-Lua-based-ESP8266-development-kit-p-2415.html">NodeMCU 1.0 module</a>)
+ * * Particle (Formally Spark) Core, <a href="https://www.particle.io/prototype#photon">Photon</a>, and <a href="https://www.particle.io/prototype#electron">Electron</a>
+ * 
+ * <h3>Examples</h3>
+ * The library includes several examples to help you get started.  These are accessible in the Examples/ThingSpeak menu off the File menu in the Arduino IDE.
+ * * <b>CheerLights:</b> Reads the latest <a href="http://www.cheerlights.com">CheerLights</a> color on ThingSpeak, and sets an RGB LED.
+ * * <b>ReadLastTemperature:</b> Reads the latest temperature from the public <a href="https://thingspeak.com/channels/12397">MathWorks weather station</a> in Natick, MA on ThingSpeak.
+ * * <b>ReadPrivateChannel:</b> Reads the latest voltage value from a private channel on ThingSpeak.
+ * * <b>ReadWeatherStation:</b> Reads the latest weather data from the public <a href="https://thingspeak.com/channels/12397">MathWorks weather station</a> in Natick, MA on ThingSpeak.
+ * * <b>WriteMultipleVoltages:</b> Reads analog voltages from pins 0-7 and writes them to the 8 fields of a channel on ThingSpeak.
+ * * <b>WriteVoltage:</b> Reads an analog voltage from pin 0, converts to a voltage, and writes it to a channel on ThingSpeak.
+ */
+
+#ifndef ThingSpeak_h
+#define ThingSpeak_h
+
+//#define PRINT_DEBUG_MESSAGES
+//#define PRINT_HTTP
+
+#ifdef SPARK
+    // Create platform defines for Particle devices
+    #if PLATFORM_ID == 6
+        #define PARTICLE_PHOTON
+        #define PARTICLE_PHOTONELECTRON
+    #elif PLATFORM_ID == 10
+        #define PARTICLE_ELECTRON
+        #define PARTICLE_PHOTONELECTRON
+    #elif PLATFORM_ID == 0
+        #define PARTICLE_CORE
+    #endif
+
+    #include "math.h"
+    #include "application.h"
+    #ifdef PARTICLE_PHOTONELECTRON
+        extern char* dtoa(double val, unsigned char prec, char *sout);
+        // On spark photon, There is no itoa, so map to ltoa.
+        #include "string_convert.h"
+        #define itoa ltoa
+    #else
+        // On spark core, a long and an int are equivalent, and so there's no "ltoa" function defined.  Map it to itoa.
+        extern char * itoa(int a, char* buffer, unsigned char radix);
+        #define ltoa itoa
+        extern char *dtostrf (double val, signed char width, unsigned char prec, char *sout);
+    #endif
+#else
+	#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266)
+	  #include "Arduino.h"
+	  #include <Client.h>
+	#else
+      #error Only Arduino Yun, Uno/Mega/Due with either Wired or wi-fi Ethernet shield, ESP8266, and Spark Core/Photon/Electron are supported.
+	#endif
+#endif
+
+#define THINGSPEAK_URL "api.thingspeak.com"
+#define THINGSPEAK_IPADDRESS IPAddress(184,106,153,149)
+#define THINGSPEAK_PORT_NUMBER 80
+
+#ifdef ARDUINO_ARCH_AVR
+    #ifdef ARDUINO_AVR_YUN
+        #define TS_USER_AGENT "tslib-arduino/1.0 (arduino yun)"
+    #else
+        #define TS_USER_AGENT "tslib-arduino/1.0 (arduino uno or mega)"
+    #endif
+#elif defined(ARDUINO_ARCH_ESP8266)
+    #define TS_USER_AGENT "tslib-arduino/1.0 (ESP8266)"
+#elif defined(SPARK)
+    #ifdef PARTICLE_CORE
+        #define TS_USER_AGENT "tslib-arduino/1.0 (particle core)"
+    #elif defined(PARTICLE_PHOTON)
+        #define TS_USER_AGENT "tslib-arduino/1.0 (particle photon)"
+    #elif defined(PARTICLE_ELECTRON)
+        #define TS_USER_AGENT "tslib-arduino/1.0 (particle electron)"
+    #endif
+    #define SPARK_PUBLISH_TTL 60 // Spark "time to live" for published messages
+    #define SPARK_PUBLISH_TOPIC "thingspeak-debug"
+#endif
+
+#define FIELDNUM_MIN 1
+#define FIELDNUM_MAX 8
+#define FIELDLENGTH_MAX 255  // Max length for a field in ThingSpeak is 255 bytes (UTF-8)
+
+#define TIMEOUT_MS_SERVERRESPONSE 5000  // Wait up to five seconds for server to respond
+
+#define OK_SUCCESS              200     // OK / Success
+#define ERR_BADAPIKEY           400     // Incorrect API key (or invalid ThingSpeak server address)
+#define ERR_BADURL              404     // Incorrect API key (or invalid ThingSpeak server address)
+#define ERR_OUT_OF_RANGE        -101    // Value is out of range or string is too long (> 255 bytes)
+#define ERR_INVALID_FIELD_NUM   -201    // Invalid field number specified
+#define ERR_SETFIELD_NOT_CALLED -210    // setField() was not called before writeFields()
+#define ERR_CONNECT_FAILED      -301    // Failed to connect to ThingSpeak
+#define ERR_UNEXPECTED_FAIL     -302    // Unexpected failure during write to ThingSpeak
+#define ERR_BAD_RESPONSE        -303    // Unable to parse response
+#define ERR_TIMEOUT             -304    // Timeout waiting for server to respond
+#define ERR_NOT_INSERTED        -401    // Point was not inserted (most probable cause is the rate limit of once every 15 seconds)
+
+/**
+ * @brief 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. 
+ */
+class ThingSpeakClass
+{
+  public:
+	ThingSpeakClass()
+	{
+		resetWriteFields();
+	    this->lastReadStatus = OK_SUCCESS;
+	};
+
+	/**
+	 * @brief Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak.
+	 * @param client EthernetClient, YunClient, TCPClient, or WiFiClient created earlier in the sketch
+	 * @param customHostName Host name of a custom install of ThingSpeak
+	 * @param port Port number to use with a custom install of ThingSpeak
+	 * @return Always returns true
+     * @comment This does not validate the information passed in, or generate any calls to ThingSpeak.
+	 * @code
+		#include <SPI.h>
+		#include <Ethernet.h>
+		byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+		EthernetClient client;
+
+		#include "ThingSpeak.h"
+
+		void setup() {
+		  Ethernet.begin(mac);
+		  ThingSpeak.begin(client,"api.thingspeak.com", 80);
+		}
+	 * @endcode
+	 */
+    bool begin(Client & client, const char * customHostName, unsigned int port)
+	{
+#ifdef PRINT_DEBUG_MESSAGES
+		Serial.print("ts::tsBegin    (client: Client URL: "); Serial.print(customHostName); Serial.println(")");
+#endif
+	this->setClient(&client);
+	this->setServer(customHostName, port);
+	resetWriteFields();
+	this->lastReadStatus = OK_SUCCESS;
+	return true;
+	};
+
+	/**
+	 * @brief Initializes the ThingSpeak library and network settings using a custom installation of ThingSpeak.
+	 * @param client EthernetClient, YunClient, TCPClient, or WiFiClient created earlier in the sketch
+	 * @param customIP IP address of a custom install of ThingSpeak
+	 * @param port Port number to use with a custom install of ThingSpeak
+	 * @return Always returns true
+     * @comment This does not validate the information passed in, or generate any calls to ThingSpeak.
+	 * @code
+		#include <SPI.h>
+		#include <Ethernet.h>
+		byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+		EthernetClient client;
+
+		#include "ThingSpeak.h"
+
+		void setup() {
+		  Ethernet.begin(mac);
+		  ThingSpeak.begin(client,IPAddress(184,106,153,149), 80);
+		}
+	 * @endcode
+	 */
+	bool begin(Client & client, IPAddress customIP, unsigned int port)
+	{
+#ifdef PRINT_DEBUG_MESSAGES
+		Serial.print("ts::tsBegin    (client: Client IP: "); Serial.print(customIP); Serial.println(")");
+#endif
+		this->setClient(&client);
+		this->setServer(customIP, port);
+		resetWriteFields();
+		this->lastReadStatus = OK_SUCCESS;
+		return true;
+	};
+
+	/**
+	 * @brief Initializes the ThingSpeak library and network settings using the ThingSpeak.com service.
+	 * @param client EthernetClient, YunClient, TCPClient, or WiFiClient created earlier in the sketch
+	 * @return Always returns true
+     * @comment This does not validate the information passed in, or generate any calls to ThingSpeak.
+	 * @code
+		#include <SPI.h>
+		#include <Ethernet.h>
+		byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
+		EthernetClient client;
+
+		#include "ThingSpeak.h"
+
+		void setup() {
+		  Ethernet.begin(mac);
+		  ThingSpeak.begin(client);
+		}
+	 * @endcode
+	 */
+	bool begin(Client & client)
+	{
+#ifdef PRINT_DEBUG_MESSAGES
+		Serial.print("ts::tsBegin");
+#endif
+		this->setClient(&client);
+		this->setServer();
+		resetWriteFields();
+		this->lastReadStatus = OK_SUCCESS;
+		return true;
+	};
+	
+	/**
+	 * @brief Write an integer value to a single field in a ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to write to.
+	 * @param value Integer value (from -32,768 to 32,767) to write.
+	 * @param writeAPIKey Write API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @remark Visit https://thingspeak.com/docs/channels for more information about channels, API keys, and fields.  ThingSpeak limits the number of writes to a channel to once every 15 seconds.
+	 * @code
+		void loop() {
+			int sensorValue = analogRead(A0);
+			ThingSpeak.writeField(myChannelNumber, 1, sensorValue, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int writeField(unsigned long channelNumber, unsigned int field, int value, const char * writeAPIKey)
+	{
+#ifdef SPARK
+        // On Spark, int and long are the same, so map to the long version
+        return writeField(channelNumber, field, (long)value, writeAPIKey);
+#else
+		char valueString[10];  // int range is -32768 to 32768, so 7 bytes including terminator, plus a little extra
+        itoa(value, valueString, 10);
+		return writeField(channelNumber, field, valueString, writeAPIKey);
+#endif
+	};
+
+	/**
+	 * @brief Write a long value to a single field in a ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to write to.
+	 * @param value Long value (from -2,147,483,648 to 2,147,483,647) to write.
+	 * @param writeAPIKey Write API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @remark Visit https://thingspeak.com/docs/channels for more information about channels, API keys, and fields.  ThingSpeak limits the number of writes to a channel to once every 15 seconds.
+	 * @code
+		void loop() {
+			int sensorValue = analogRead(A0);
+			ThingSpeak.writeField(myChannelNumber, 1, sensorValue, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int writeField(unsigned long channelNumber, unsigned int field, long value, const char * writeAPIKey)
+	{
+		char valueString[15];  // long range is -2147483648 to 2147483647, so 12 bytes including terminator
+   		ltoa(value, valueString, 10);
+		return writeField(channelNumber, field, valueString, writeAPIKey);
+	};
+
+	/**
+	 * @brief Write a floating point value to a single field in a ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to write to.
+	 * @param value Floating point value (from -999999000000 to 999999000000) to write.  If you need more accuracy, or a wider range, you should format the number using <tt>dtostrf</tt> and writeField().
+	 * @param writeAPIKey Write API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @remark Visit https://thingspeak.com/docs/channels for more information about channels, API keys, and fields.  ThingSpeak limits the number of writes to a channel to once every 15 seconds.
+	 * @code
+		void loop() {
+			int sensorValue = analogRead(A0);
+			float voltage = sensorValue * (5.0 / 1023.0);
+			ThingSpeak.writeField(myChannelNumber, 1, voltage, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int writeField(unsigned long channelNumber, unsigned int field, float value, const char * writeAPIKey)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::writeField (channelNumber: "); Serial.print(channelNumber); Serial.print(" writeAPIKey: "); Serial.print(writeAPIKey); Serial.print(" field: "); Serial.print(field); Serial.print(" value: "); Serial.print(value,5); Serial.println(")");
+		#endif
+		char valueString[20]; // range is -999999000000.00000 to 999999000000.00000, so 19 + 1 for the terminator
+		int status = convertFloatToChar(value, valueString);
+		if(status != OK_SUCCESS) return status;
+
+		return writeField(channelNumber, field, valueString, writeAPIKey);
+	};
+
+	/**
+	 * @brief Write a string to a single field in a ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to write to.
+	 * @param value String to write (UTF8 string).  ThingSpeak limits this field to 255 bytes.
+	 * @param writeAPIKey Write API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @remark Visit https://thingspeak.com/docs/channels for more information about channels, API keys, and fields.  ThingSpeak limits the number of writes to a channel to once every 15 seconds.
+	 * @code
+		void loop() {
+			int sensorValue = analogRead(A0);
+			if (sensorValue > 512) {
+				ThingSpeak.writeField(myChannelNumber, 1, "High", myWriteAPIKey);
+			}
+			else {
+				ThingSpeak.writeField(myChannelNumber, 1, "Low", myWriteAPIKey);
+			}
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int writeField(unsigned long channelNumber, unsigned int field, const char * value, const char * writeAPIKey)
+	{
+		return writeField(channelNumber, field, String(value), writeAPIKey);
+	};
+
+	/**
+	 * @brief Write a String to a single field in a ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to write to.
+	 * @param value Character array (zero terminated) to write (UTF8).  ThingSpeak limits this field to 255 bytes.
+	 * @param writeAPIKey Write API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @remark Visit https://thingspeak.com/docs/channels for more information about channels, API keys, and fields.  ThingSpeak limits the number of writes to a channel to once every 15 seconds.
+	 * @code
+		void loop() {
+			int sensorValue = analogRead(A0);
+			String meaning;
+			if (sensorValue < 400) {
+				meaning = String("Too Cold!");
+			} else if (sensorValue > 600) {
+				meaning = String("Too Hot!");
+			} else {
+				meaning = String("Just Right");
+			}
+			ThingSpeak.writeField(myChannelNumber, 1, meaning, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int writeField(unsigned long channelNumber, unsigned int field, String value, const char * writeAPIKey)
+	{
+		// Invalid field number specified
+		if(field < FIELDNUM_MIN || field > FIELDNUM_MAX) return ERR_INVALID_FIELD_NUM;
+		// Max # bytes for ThingSpeak field is 255
+		if(value.length() > FIELDLENGTH_MAX) return ERR_OUT_OF_RANGE;
+		
+		#ifdef PRINT_DEBUG_MESSAGES
+		  #ifdef SPARK
+            Particle.publish(SPARK_PUBLISH_TOPIC, "writeField (" + String(channelNumber) + ", " + String(writeAPIKey) + ", " + String(field) + ", " + String(value) + ")", SPARK_PUBLISH_TTL, PRIVATE);
+          #else
+			Serial.print("ts::writeField (channelNumber: "); Serial.print(channelNumber); Serial.print(" writeAPIKey: "); Serial.print(writeAPIKey); Serial.print(" field: "); Serial.print(field); Serial.print(" value: \""); Serial.print(value); Serial.println("\")");
+		  #endif
+		#endif
+		String postMessage = String("field") + String(field) + "=" + value;
+		return writeRaw(channelNumber, postMessage, writeAPIKey);
+ 	};
+
+    
+	/**
+	 * @brief Set the value of a single field that will be part of a multi-field update.
+	 * To write multiple fields at once, call setField() for each of the fields you want to write, and then call writeFields()
+	 * @param field Field number (1-8) within the channel to set
+	 * @param value Integer value (from -32,768 to 32,767) to set.
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setLatitude(), setLongitude(), setElevation(), writeFields()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int setField(unsigned int field, int value)
+	{
+#ifdef SPARK
+        // On Spark, int and long are the same, so map to the long version
+        return setField(field, (long)value);
+#else
+		char valueString[10];  // int range is -32768 to 32768, so 7 bytes including terminator
+	    itoa(value, valueString, 10);
+		
+		return setField(field, valueString);
+#endif
+	};
+
+	/**
+	 * @brief Set the value of a single field that will be part of a multi-field update.
+	 * To write multiple fields at once, call setField() for each of the fields you want to write, and then call writeFields()
+	 * @param field Field number (1-8) within the channel to set
+	 * @param value Long value (from -2,147,483,648 to 2,147,483,647) to write.
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setLatitude(), setLongitude(), setElevation(), writeFields()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int setField(unsigned int field, long value)
+	{
+		char valueString[15];  // long range is -2147483648 to 2147483647, so 12 bytes including terminator
+	    ltoa(value, valueString, 10);
+		return setField(field, valueString);
+	};
+
+
+	/**
+	 * @brief Set the value of a single field that will be part of a multi-field update.
+	 * To write multiple fields at once, call setField() for each of the fields you want to write, and then call writeFields()
+	 * @param field Field number (1-8) within the channel to set
+	 * @param value Floating point value (from -999999000000 to 999999000000) to write.  If you need more accuracy, or a wider range, you should format the number yourself (using <tt>dtostrf</tt>) and setField() using the resulting string.
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setLatitude(), setLongitude(), setElevation(), writeFields()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+    int setField(unsigned int field, float value)
+	{
+		char valueString[20]; // range is -999999000000.00000 to 999999000000.00000, so 19 + 1 for the terminator
+		int status = convertFloatToChar(value, valueString);
+		if(status != OK_SUCCESS) return status;
+
+		return setField(field, valueString);
+	};
+
+	/**
+	 * @brief Set the value of a single field that will be part of a multi-field update.
+	 * To write multiple fields at once, call setField() for each of the fields you want to write, and then call writeFields()
+	 * @param field Field number (1-8) within the channel to set
+	 * @param value String to write (UTF8).  ThingSpeak limits this to 255 bytes.  
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setLatitude(), setLongitude(), setElevation(), writeFields()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+    int setField(unsigned int field, const char * value)
+	{
+		return setField(field, String(value));
+	};
+
+	/**
+	 * @brief Set the value of a single field that will be part of a multi-field update.
+	 * To write multiple fields at once, call setField() for each of the fields you want to write, and then call writeFields()
+	 * @param field Field number (1-8) within the channel to set
+	 * @param value String to write (UTF8).  ThingSpeak limits this to 255 bytes.
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setLatitude(), setLongitude(), setElevation(), writeFields()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+    int setField(unsigned int field, String value)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+		  #ifdef SPARK
+            Particle.publish(SPARK_PUBLISH_TOPIC, "setField " + String(field) + " to " + String(value), SPARK_PUBLISH_TTL, PRIVATE);
+          #else
+			Serial.print("ts::setField   (field: "); Serial.print(field); Serial.print(" value: \""); Serial.print(value); Serial.println("\")");
+		  #endif
+		#endif
+		if(field < FIELDNUM_MIN || field > FIELDNUM_MAX) return ERR_INVALID_FIELD_NUM;
+		// Max # bytes for ThingSpeak field is 255 (UTF-8)
+		if(value.length() > FIELDLENGTH_MAX) return ERR_OUT_OF_RANGE;
+		this->nextWriteField[field - 1] = value;
+		return OK_SUCCESS;
+	};
+
+
+	/**
+	 * @brief Set the latitude of a multi-field update.
+	 * To record latitude, longitude and elevation of a write, call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields()
+	 * @param latitude Latitude of the measurement (degrees N, use negative values for degrees S)
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setField(), setLongitude(), setElevation(), writeFields()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			setLatitude(42.2833);
+			setLongitude(-71.3500);
+			setElevation(100);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int setLatitude(float latitude)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::setLatitude(latitude: "); Serial.print(latitude,3); Serial.println("\")");
+		#endif
+		this->nextWriteLatitude = latitude;
+		return OK_SUCCESS;
+	};
+
+
+	/**
+	 * @brief Set the longitude of a multi-field update.
+	 * To record latitude, longitude and elevation of a write, call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields()
+	 * @param longitude Longitude of the measurement (degrees E, use negative values for degrees W)
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setField(), setLatitude(), setElevation(), writeFields()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			setLatitude(42.2833);
+			setLongitude(-71.3500);
+			setElevation(100);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int setLongitude(float longitude)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::setLongitude(longitude: "); Serial.print(longitude,3); Serial.println("\")");
+		#endif
+		this->nextWriteLongitude = longitude;
+		return OK_SUCCESS;
+	};
+
+
+	/**
+	 * @brief Set the elevation of a multi-field update.
+	 * To record latitude, longitude and elevation of a write, call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields()
+	 * @param elevation Elevation of the measurement (meters above sea level)
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setField(), setLatitude(), setLongitude(), writeFields()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			setLatitude(42.2833);
+			setLongitude(-71.3500);
+			setElevation(100);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int setElevation(float elevation)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::setElevation(elevation: "); Serial.print(elevation,3); Serial.println("\")");
+		#endif
+		this->nextWriteElevation = elevation;
+		return OK_SUCCESS;
+	};
+
+
+	/**
+	 * @brief Write a multi-field update.
+	 * Call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields()
+	 * @param channelNumber Channel number
+	 * @param writeAPIKey Write API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @see setField(), setLatitude(), setLongitude(), setElevation()
+	 * @code
+		void loop() {
+			int sensor1Value = analogRead(A0);
+			float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
+			String sensor3Meaning;
+			int sensor3Value = analogRead(A2);
+			if (sensor3Value < 400) {
+				sensor3Meaning = String("Too Cold!");
+			} else if (sensor3Value > 600) {
+				sensor3Meaning = String("Too Hot!");
+			} else {
+				sensor3Meaning = String("Just Right");
+			}
+			long timeRead = millis();
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			setLatitude(42.2833);
+			setLongitude(-71.3500);
+			setElevation(100);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int writeFields(unsigned long channelNumber, const char * writeAPIKey)
+	{
+		String postMessage = String("");
+		bool fFirstItem = true;
+		for(size_t iField = 0; iField < 8; iField++)
+		{
+			if(this->nextWriteField[iField].length() > 0)
+			{
+				if(!fFirstItem)
+				{
+					postMessage = postMessage + String("&");
+				}
+				postMessage = postMessage + String("field") + String(iField + 1) + String("=") + this->nextWriteField[iField];
+				fFirstItem = false;
+				this->nextWriteField[iField] = "";
+			}
+		}
+
+		if(!isnan(nextWriteLatitude))
+		{
+			if(!fFirstItem)
+			{
+				postMessage = postMessage + String("&");
+			}
+			postMessage = postMessage + String("lat=") + String(this->nextWriteLatitude);
+			fFirstItem = false;
+			this->nextWriteLatitude = NAN;
+		}
+
+		if(!isnan(this->nextWriteLongitude))
+		{
+			if(!fFirstItem)
+			{
+				postMessage = postMessage + String("&");
+			}
+			postMessage = postMessage + String("long=") + String(this->nextWriteLongitude);
+			fFirstItem = false;
+			this->nextWriteLongitude = NAN;
+		}
+
+
+		if(!isnan(this->nextWriteElevation))
+		{
+			if(!fFirstItem)
+			{
+				postMessage = postMessage + String("&");
+			}
+			postMessage = postMessage + String("elevation=") + String(this->nextWriteElevation);
+			fFirstItem = false;
+			this->nextWriteElevation = NAN;
+		}
+
+		if(fFirstItem)
+		{
+			// setField was not called before writeFields
+			return ERR_SETFIELD_NOT_CALLED;
+		}
+
+		return writeRaw(channelNumber, postMessage, writeAPIKey);
+	};
+
+
+	/**
+	 * @brief Write a raw POST to a ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param postMessage Raw URL to write to ThingSpeak as a string.  See the documentation at https://thingspeak.com/docs/channels#update_feed.
+	 * @param writeAPIKey Write API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @remark This is low level functionality that will not be required by most users.
+	 * @code
+		void loop() {
+			const char postMessage[] = "field1=23&created_at=2014-12-31%2023:59:59";
+
+			ThingSpeak.setField(1, sensor1Value);
+			ThingSpeak.setField(2, sensor2Voltage);
+			ThingSpeak.setField(3, sensor3Meaning);
+			ThingSpeak.setField(4, timeRead);
+			ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int writeRaw(unsigned long channelNumber, const char * postMessage, const char * writeAPIKey)
+	{
+		return writeRaw(channelNumber, String(postMessage), writeAPIKey);
+	};
+
+
+	/**
+	 * @brief Write a raw POST to a ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param postMessage Raw URL to write to ThingSpeak as a String.  See the documentation at https://thingspeak.com/docs/channels#update_feed.
+	 * @param writeAPIKey Write API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return HTTP status code of 200 if successful.  See getLastReadStatus() for other possible return values.
+	 * @remark This is low level functionality that will not be required by most users.
+	 * @code
+		void loop() {
+			String postMessage = String("field1=23&created_at=2014-12-31%2023:59:59");
+			ThingSpeak.writeRaw(myChannelNumber, postMessage, myWriteAPIKey);
+			delay(20000);
+		}
+	 * @endcode
+	 */
+	int writeRaw(unsigned long channelNumber, String postMessage, const char * writeAPIKey)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::writeRaw   (channelNumber: "); Serial.print(channelNumber); Serial.print(" writeAPIKey: "); Serial.print(writeAPIKey); Serial.print(" postMessage: \""); Serial.print(postMessage); Serial.println("\")");
+		#endif
+
+		if(!connectThingSpeak())
+		{
+			// Failed to connect to ThingSpeak
+			return ERR_CONNECT_FAILED;
+		}
+
+		postMessage = postMessage + String("&headers=false");
+
+		#ifdef PRINT_DEBUG_MESSAGES
+		  #ifdef SPARK
+            Particle.publish(SPARK_PUBLISH_TOPIC, "Post " + postMessage, SPARK_PUBLISH_TTL, PRIVATE);
+          #else
+			Serial.print("               POST \"");Serial.print(postMessage);Serial.println("\"");
+		  #endif
+		#endif
+
+		postMessage = postMessage + String("\n");
+
+		// Post data to thingspeak
+		if(!this->client->print("POST /update HTTP/1.1\n")) return abortWriteRaw();
+		if(!writeHTTPHeader(writeAPIKey)) return abortWriteRaw();
+		if(!this->client->print("Content-Type: application/x-www-form-urlencoded\n")) return abortWriteRaw();
+		if(!this->client->print("Content-Length: ")) return abortWriteRaw();
+		if(!this->client->print(postMessage.length())) return abortWriteRaw();
+		if(!this->client->print("\n\n")) return abortWriteRaw();
+		if(!this->client->print(postMessage)) return abortWriteRaw();
+  
+		String entryIDText = String();
+		int status = getHTTPResponse(entryIDText);
+		if(status != OK_SUCCESS)
+		{
+			client->stop();
+			return status;
+		}
+		long entryID = entryIDText.toInt();
+
+		#ifdef PRINT_DEBUG_MESSAGES
+		Serial.print("               Entry ID \"");Serial.print(entryIDText);Serial.print("\" (");Serial.print(entryID);Serial.println(")");
+		#endif
+
+		client->stop();
+		
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.println("disconnected.");
+		#endif
+		if(entryID == 0)
+		{
+			// ThingSpeak did not accept the write
+			status = ERR_NOT_INSERTED;
+		}
+		return status;
+	};
+	
+	/**
+	 * @brief Read the latest string from a private ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to read from.
+	 * @param readAPIKey Read API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return Value read (UTF8 string), or empty string if there is an error.  Use getLastReadStatus() to get more specific information.
+	 * @code
+		void loop() {
+		  String message = ThingSpeak.readStringField(myChannelNumber, 1, myReadAPIKey);
+		  Serial.print("Latest message is: "); 
+		  Serial.println(message);
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+    String readStringField(unsigned long channelNumber, unsigned int field, const char * readAPIKey)
+	{
+		if(field < FIELDNUM_MIN || field > FIELDNUM_MAX)
+		{
+			this->lastReadStatus = ERR_INVALID_FIELD_NUM;
+			return("");
+		}
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::readStringField(channelNumber: "); Serial.print(channelNumber); 
+			if(NULL != readAPIKey)
+			{
+				Serial.print(" readAPIKey: "); Serial.print(readAPIKey);
+			}
+			Serial.print(" field: "); Serial.print(field); Serial.println(")");
+		#endif
+		return readRaw(channelNumber, String(String("/fields/") + String(field) + String("/last")), readAPIKey);
+	}
+
+
+	/**
+	 * @brief Read the latest string from a public ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to read from.
+	 * @return Value read (UTF8), or empty string if there is an error.  Use getLastReadStatus() to get more specific information.
+	 * @code
+		void loop() {
+		  String message = ThingSpeak.readStringField(myChannelNumber, 1);
+		  Serial.print("Latest message is: "); 
+		  Serial.println(message);
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+	String readStringField(unsigned long channelNumber, unsigned int field)
+	{
+		return readStringField(channelNumber, field, NULL);
+	};
+
+
+	/**
+	 * @brief Read the latest float from a private ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to read from.
+	 * @param readAPIKey Read API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return Value read, or 0 if the field is text or there is an error.  Use getLastReadStatus() to get more specific information.  Note that NAN, INFINITY, and -INFINITY are valid results.
+	 * @code
+		void loop() {
+		  float voltage = ThingSpeak.readFloatField(myChannelNumber, 1, myReadAPIKey);
+		  Serial.print("Latest voltage is: "); 
+		  Serial.print(voltage);
+		  Serial.println("V"); 
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+    float readFloatField(unsigned long channelNumber, unsigned int field, const char * readAPIKey)
+	{
+		return convertStringToFloat(readStringField(channelNumber, field, readAPIKey));
+	};
+
+
+	/**
+	 * @brief Read the latest float from a public ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to read from.
+	 * @return Value read, or 0 if the field is text or there is an error.  Use getLastReadStatus() to get more specific information.  Note that NAN, INFINITY, and -INFINITY are valid results.
+	 * @code
+		void loop() {
+		  float voltage = ThingSpeak.readFloatField(myChannelNumber, 1);
+		  Serial.print("Latest voltage is: "); 
+		  Serial.print(voltage);
+		  Serial.println("V"); 
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+    float readFloatField(unsigned long channelNumber, unsigned int field)
+	{
+		return readFloatField(channelNumber, field, NULL);
+	};
+
+
+	/**
+	 * @brief Read the latest long from a private ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to read from.
+	 * @param readAPIKey Read API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return Value read, or 0 if the field is text or there is an error.  Use getLastReadStatus() to get more specific information.
+	 * @code
+		void loop() {
+		  long value = ThingSpeak.readLongField(myChannelNumber, 1, myReadAPIKey);
+		  Serial.print("Latest value is: "); 
+		  Serial.print(value);
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+    long readLongField(unsigned long channelNumber, unsigned int field, const char * readAPIKey)
+	{
+        // Note that although the function is called "toInt" it really returns a long.
+		return readStringField(channelNumber, field, readAPIKey).toInt();
+	}
+
+
+	/**
+	 * @brief Read the latest long from a public ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to read from.
+	 * @return Value read, or 0 if the field is text or there is an error.  Use getLastReadStatus() to get more specific information.
+	 * @code
+		void loop() {
+		  long value = ThingSpeak.readLongField(myChannelNumber, 1);
+		  Serial.print("Latest value is: "); 
+		  Serial.print(value);
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+	long readLongField(unsigned long channelNumber, unsigned int field)
+	{
+		return readLongField(channelNumber, field, NULL);
+	};
+
+
+	/**
+	 * @brief Read the latest int from a private ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to read from.
+	 * @param readAPIKey Read API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return Value read, or 0 if the field is text or there is an error.  Use getLastReadStatus() to get more specific information.
+	 * @remark If the value returned is out of range for an int, the result is undefined.
+	 * @code
+		void loop() {
+		  int value = ThingSpeak.readIntField(myChannelNumber, 1, myReadAPIKey);
+		  Serial.print("Latest value is: "); 
+		  Serial.print(value);
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+    int readIntField(unsigned long channelNumber, unsigned int field, const char * readAPIKey)
+	{
+		return readLongField(channelNumber, field, readAPIKey);
+	}
+
+
+	/**
+	 * @brief Read the latest int from a public ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param field Field number (1-8) within the channel to read from.
+	 * @return Value read, or 0 if the field is text or there is an error.  Use getLastReadStatus() to get more specific information.
+	 * @remark If the value returned is out of range for an int, the result is undefined.
+	 * @code
+		void loop() {
+		  int value = ThingSpeak.readIntField(myChannelNumber, 1);
+		  Serial.print("Latest value is: "); 
+		  Serial.print(value);
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+    int readIntField(unsigned long channelNumber, unsigned int field)
+	{
+		return readLongField(channelNumber, field, NULL);
+	};
+	
+	/**
+	 * @brief Read a raw response from a public ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param URLSuffix Raw URL to write to ThingSpeak as a String.  See the documentation at https://thingspeak.com/docs/channels#get_feed
+	 * @return Response if successful, or empty string.	 Use getLastReadStatus() to get more specific information.
+	 * @remark This is low level functionality that will not be required by most users.
+	 * @code
+		void loop() {
+		  String response = ThingSpeak.readRaw(myChannelNumber, String("feeds/days=1"));
+		  Serial.print("Response: "); 
+		  Serial.print(response);
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+	String readRaw(unsigned long channelNumber, String URLSuffix)
+	{
+		return readRaw(channelNumber, URLSuffix, NULL);
+	}
+	
+	/**
+	 * @brief Read a raw response from a private ThingSpeak channel
+	 * @param channelNumber Channel number
+	 * @param URLSuffix Raw URL to write to ThingSpeak as a String.  See the documentation at https://thingspeak.com/docs/channels#get_feed
+	 * @param readAPIKey Read API key associated with the channel.  *If you share code with others, do _not_ share this key*
+	 * @return Response if successful, or empty string.	 Use getLastReadStatus() to get more specific information.
+	 * @remark This is low level functionality that will not be required by most users.
+	 * @code
+		void loop() {
+		  String response = ThingSpeak.readRaw(myChannelNumber, String("feeds/days=1"), myReadAPIKey);
+		  Serial.print("Response: "); 
+		  Serial.print(response);
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+	String readRaw(unsigned long channelNumber, String URLSuffix, const char * readAPIKey)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::readRaw   (channelNumber: "); Serial.print(channelNumber);
+			if(NULL != readAPIKey)
+			{
+				Serial.print(" readAPIKey: "); Serial.print(readAPIKey);
+			}
+			Serial.print(" URLSuffix: \""); Serial.print(URLSuffix); Serial.println("\")");
+		#endif
+
+		if(!connectThingSpeak())
+		{
+			this->lastReadStatus = ERR_CONNECT_FAILED;
+			return String("");
+		}
+
+		String URL = String("/channels/") + String(channelNumber) + URLSuffix;
+
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("               GET \"");Serial.print(URL);Serial.println("\"");
+		#endif
+
+		// Post data to thingspeak
+		if(!this->client->print("GET ")) return abortReadRaw();
+		if(!this->client->print(URL)) return abortReadRaw();
+		if(!this->client->print(" HTTP/1.1\n")) return abortReadRaw();
+		if(!writeHTTPHeader(readAPIKey)) return abortReadRaw();
+		if(!this->client->print("\n")) return abortReadRaw();
+ 
+		String content = String();
+		int status = getHTTPResponse(content);
+		this->lastReadStatus = status;
+
+
+		#ifdef PRINT_DEBUG_MESSAGES
+			if(status == OK_SUCCESS)
+			{
+				Serial.print("Read: \""); Serial.print(content); Serial.println("\"");
+			}
+		#endif
+
+		client->stop();
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.println("disconnected.");
+		#endif
+
+		if(status != OK_SUCCESS)
+		{
+			// return status;
+			return String("");
+		}
+
+        // This is a workaround to a bug in the Spark implementation of String
+    	return String("") + content;
+	};
+	
+	/**
+	 * @brief Get the status of the previous read.
+	 * @return Generally, these are HTTP status codes.  Negative values indicate an error generated by the library.
+	 * Possible response codes:
+	 *  * 200: OK / Success
+	 *  * 404: Incorrect API key (or invalid ThingSpeak server address)
+	 *  * -101: Value is out of range or string is too long (> 255 characters)
+	 *  * -201: Invalid field number specified
+	 *  * -210: setField() was not called before writeFields()
+	 *  * -301: Failed to connect to ThingSpeak
+	 *  * -302: Unexpected failure during write to ThingSpeak
+	 *  * -303: Unable to parse response
+     *  * -304: Timeout waiting for server to respond
+	 *  * -401: Point was not inserted (most probable cause is the rate limit of once every 15 seconds)
+	 * @remark The read functions will return zero or empty if there is an error.  Use this function to retrieve the details.
+	 * @code
+		void loop() {
+		  String message = ThingSpeak.readStringField(myChannelNumber, 1);
+		  int resultCode = ThingSpeak.getLastReadStatus();
+		  if(resultCode == 200)
+		  {
+			  Serial.print("Latest message is: "); 
+			  Serial.println(message);
+		  }
+		  else
+		  {
+			  Serial.print("Error reading message.  Status was: "); 
+			  Serial.println(resultCode);
+		  }
+		  delay(30000);
+		}
+	 * @endcode
+	 */
+	int getLastReadStatus()
+	{
+		return this->lastReadStatus;
+	};
+private:
+
+    int abortWriteRaw()
+    {
+        this->client->stop();
+        return ERR_UNEXPECTED_FAIL;
+    }
+
+    String abortReadRaw()
+    {
+		this->client->stop();
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.println("ReadRaw abort - disconnected.");
+		#endif
+		this->lastReadStatus = ERR_UNEXPECTED_FAIL;
+		return String("");
+    }
+
+	void setServer(const char * customHostName, unsigned int port)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::setServer  (URL: \""); Serial.print(customHostName); Serial.println("\")");
+		#endif
+		this->customIP = INADDR_NONE;
+		this->customHostName = customHostName;
+        this->port = port;
+	};
+
+	void setServer(IPAddress customIP, unsigned int port)
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::setServer  (IP: \""); Serial.print(customIP); Serial.println("\")");
+		#endif
+		this->customIP = customIP;
+		this->customHostName = NULL;
+        this->port = port;
+	};
+
+	void setServer()
+	{
+		#ifdef PRINT_DEBUG_MESSAGES
+			Serial.print("ts::setServer  (default)");
+		#endif
+		this->customIP = INADDR_NONE;
+		this->customHostName = NULL;
+        this->port = THINGSPEAK_PORT_NUMBER;
+	};
+
+	void setClient(Client * client) {this->client = client;};
+
+	Client * client = NULL;
+	const char * customHostName = NULL;
+	IPAddress customIP = INADDR_NONE;
+    unsigned int port = THINGSPEAK_PORT_NUMBER;
+	String nextWriteField[8];
+	float nextWriteLatitude;
+	float nextWriteLongitude;
+	float nextWriteElevation;
+	int lastReadStatus;
+
+	bool connectThingSpeak()
+	{
+		bool connectSuccess = false;
+		if(this->customIP == INADDR_NONE && NULL == this->customHostName)
+        {
+ 			#ifdef PRINT_DEBUG_MESSAGES
+  			    Serial.print("               Connect to default ThingSpeak URL...");
+			#endif
+			connectSuccess = client->connect(THINGSPEAK_URL,THINGSPEAK_PORT_NUMBER);
+            if(!connectSuccess)
+            {
+ 			    #ifdef PRINT_DEBUG_MESSAGES
+  			        Serial.print("Failed. Try default IP...");
+			    #endif
+			    connectSuccess = client->connect(THINGSPEAK_IPADDRESS,THINGSPEAK_PORT_NUMBER);
+            }
+       }
+       else
+       {
+		    if(!(this->customIP == INADDR_NONE))
+		    {
+			    // Connect to the server on port 80 (HTTP) at the customIP address
+			    #ifdef PRINT_DEBUG_MESSAGES
+  			      Serial.print("               Connect to ");Serial.print(this->customIP);Serial.print("...");
+			    #endif
+			    connectSuccess = client->connect(this->customIP,this->port);
+		    }
+		    if(NULL != this->customHostName)
+		    {
+			    // Connect to the server on port 80 (HTTP) at the URL address
+			    #ifdef PRINT_DEBUG_MESSAGES
+    		      #ifdef SPARK
+                    Particle.publish(SPARK_PUBLISH_TOPIC, "Attempt Connect to URL " + String(this->customHostName), SPARK_PUBLISH_TTL, PRIVATE);
+                  #else
+				    Serial.print("               Connect to ");Serial.print(this->customHostName);Serial.print(" ...");
+			      #endif
+			    #endif
+			    connectSuccess = client->connect(customHostName,this->port);
+		    }
+        }
+
+		#ifdef PRINT_DEBUG_MESSAGES
+		if (connectSuccess)
+		{
+    	    #ifdef SPARK
+              Particle.publish(SPARK_PUBLISH_TOPIC, "Connection Success", SPARK_PUBLISH_TTL, PRIVATE);
+            #else
+		      Serial.println("Success.");
+		    #endif
+		}
+		else
+		{
+    	    #ifdef SPARK
+              Particle.publish(SPARK_PUBLISH_TOPIC, "Connection Failure", SPARK_PUBLISH_TTL, PRIVATE);
+            #else
+  			  Serial.println("Failed.");
+  			#endif
+		}
+		#endif
+		return connectSuccess;
+	};
+
+	bool writeHTTPHeader(const char * APIKey)
+	{
+        if(NULL != this->customHostName)
+        {
+		    if (!this->client->print("Host: ")) return false;
+		    if (!this->client->print(this->customHostName)) return false;
+		    if (!this->client->print("\n")) return false;
+        }
+        else
+        {
+		    if (!this->client->print("Host: api.thingspeak.com\n")) return false;
+        }
+		if (!this->client->print("Connection: close\n")) return false;
+		if (!this->client->print("User-Agent: ")) return false;
+		if (!this->client->print(TS_USER_AGENT)) return false;
+		if (!this->client->print("\n")) return false;
+		if(NULL != APIKey)
+		{
+			if (!this->client->print("X-THINGSPEAKAPIKEY: ")) return false;
+			if (!this->client->print(APIKey)) return false;
+			if (!this->client->print("\n")) return false;
+		}
+		return true;
+	};
+
+	int getHTTPResponse(String & response)
+	{
+        long startWaitForResponseAt = millis();
+        while(client->available() == 0 && millis() - startWaitForResponseAt < TIMEOUT_MS_SERVERRESPONSE)
+        {
+            delay(100);
+        }
+        if(client->available() == 0)
+        {
+			return ERR_TIMEOUT; // Didn't get server response in time
+        }
+
+		if(!client->find(const_cast<char *>("HTTP/1.1")))
+		{
+			#ifdef PRINT_HTTP
+                #ifdef SPARK
+                    Particle.publish(SPARK_PUBLISH_TOPIC, "ERROR: Didn't find HTTP/1.1", SPARK_PUBLISH_TTL, PRIVATE);
+                #else
+    				Serial.println("ERROR: Didn't find HTTP/1.1");
+    			#endif
+    		#endif
+			return ERR_BAD_RESPONSE; // Couldn't parse response (didn't find HTTP/1.1)
+		}
+		int status = client->parseInt();
+		#ifdef PRINT_HTTP
+            #ifdef SPARK
+                Particle.publish(SPARK_PUBLISH_TOPIC, "Got Status of " + String(status), SPARK_PUBLISH_TTL, PRIVATE);
+            #else
+    			Serial.print("Got Status of ");Serial.println(status);
+    		#endif
+		#endif
+		if(status != OK_SUCCESS)
+		{
+			return status;
+		}
+
+		if(!client->find(const_cast<char *>("\r\n")))
+		{
+			#ifdef PRINT_HTTP
+                #ifdef SPARK
+                    Particle.publish(SPARK_PUBLISH_TOPIC, "ERROR: Didn't find end of status line", SPARK_PUBLISH_TTL, PRIVATE);
+                #else
+    				Serial.println("ERROR: Didn't find end of status line");
+    			#endif
+			#endif
+			return ERR_BAD_RESPONSE;
+		}
+		#ifdef PRINT_HTTP
+            #ifdef SPARK
+                Particle.publish(SPARK_PUBLISH_TOPIC, "Found end of status line", SPARK_PUBLISH_TTL, PRIVATE);
+            #else
+    			Serial.println("Found end of status line");
+    	    #endif
+		#endif
+
+		if(!client->find(const_cast<char *>("\n\r\n")))
+		{
+			#ifdef PRINT_HTTP
+                #ifdef SPARK
+                    Particle.publish(SPARK_PUBLISH_TOPIC, "ERROR: Didn't find end of header", SPARK_PUBLISH_TTL, PRIVATE);
+                #else
+    				Serial.println("ERROR: Didn't find end of header");
+    			#endif
+			#endif
+			return ERR_BAD_RESPONSE;
+		}
+		#ifdef PRINT_HTTP
+            #ifdef SPARK
+                Particle.publish(SPARK_PUBLISH_TOPIC, "Found end of header", SPARK_PUBLISH_TTL, PRIVATE);
+            #else
+			    Serial.println("Found end of header");
+			#endif
+		#endif
+		// This is a workaround to a bug in the Spark implementation of String
+		String tempString = client->readStringUntil('\r');
+		response = tempString;
+		#ifdef PRINT_HTTP
+            #ifdef SPARK
+                Particle.publish(SPARK_PUBLISH_TOPIC, "Response: \"" + tempString + "\"", SPARK_PUBLISH_TTL, PRIVATE);
+            #else
+    			Serial.print("Response: \"");Serial.print(response);Serial.println("\"");
+			#endif
+		#endif
+		return status;
+	};
+
+	int convertFloatToChar(float value, char *valueString)
+	{
+		// Supported range is -999999000000 to 999999000000
+		if(0 == isinf(value) && (value > 999999000000 || value < -999999000000))
+		{
+			// Out of range
+			return ERR_OUT_OF_RANGE;
+		}
+		// Given that the resolution of Spark is 1 / 2^12, or ~0.00024 volts, assume that 5 places right of decimal should be sufficient for most applications
+        #ifdef PARTICLE_PHOTONELECTRON
+          //Photon doesn't have a dtostrf, but does have dtoa
+          dtoa((double)value,5, valueString);
+        #else
+		  dtostrf(value,1,5, valueString);
+        #endif
+		return OK_SUCCESS;
+	};
+
+	float convertStringToFloat(String value)
+	{
+		// There's a bug in the AVR function strtod that it doesn't decode -INF correctly (it maps it to INF)
+		float result = value.toFloat();
+		if(1 == isinf(result) && *value.c_str() == '-')
+		{
+			result = (float)-INFINITY;
+		}
+		return result;
+	};
+
+	void resetWriteFields()
+	{
+		for(size_t iField = 0; iField < 8; iField++)
+		{
+			this->nextWriteField[iField] = "";
+		}
+		this->nextWriteLatitude = NAN;
+		this->nextWriteLongitude = NAN;
+		this->nextWriteElevation = NAN;
+	};
+};
+
+extern ThingSpeakClass ThingSpeak;
+
+#endif //ThingSpeak_h
