SERVER BASED REMOTE

 

Control your Things from any Corner of world.......!!



/************************ CODE BEGINS HERE ************************/

#include <ThingSpeak.h>               // add library

#include <ESP8266WiFi.h>


WiFiClient  client;

unsigned long counterChannelNumber = 980157;                // Channel ID

const char * myCounterReadAPIKey = "CL8DHB4NZ43291ZI";      // Read API Key

const int FieldNumber1 = 1;                                 // The field you wish to read

const int FieldNumber2 = 2;                                 // The field you wish to read


void setup()

{

  pinMode(13,OUTPUT);

  Serial.begin(115200);

  Serial.println();


  WiFi.begin("WIFI_SSID", "WIFI_PASS");                 // write your personal wifi name & password           

  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() 

{

 int A = ThingSpeak.readLongField(counterChannelNumber, FieldNumber1, myCounterReadAPIKey);

 Serial.println(A);

 digitalWrite(13,A);

}



Comments

Popular posts from this blog

IDE SETUP FILES

NON-SERVER CONTROLLER

Print String on 16X2 LCD