Io TDispaly Code
Io TDispaly Code
h>
#include <ESP8266WiFi.h>
WiFiClient client;
unsigned long counterChannelNumber = 1029806; // Channel ID
const char * myCounterReadAPIKey = "1YZAWOVHNTTYXVA3"; // Read API Key
const int FieldNumber1 = 1; // The field you wish
to read
String presentStr,previousStr = " ";
void setup()
{
lcd.begin(16, 2);
Serial.begin(115200);
Serial.println();
Serial.print("Connecting");
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Connected, IP address: ");
Serial.println(WiFi.localIP());
ThingSpeak.begin(client);
}
void loop()
{
presentStr = ThingSpeak.readStringField(counterChannelNumber, FieldNumber1,
myCounterReadAPIKey);
if(presentStr != previousStr)
{
lcd.clear();
Serial.println(presentStr);
lcd.setCursor(0, 0);
lcd.print(presentStr);
previousStr = presentStr;
}
}