Team Updates

Codes:

Code1:

/////////////////////////////////

// Generated with a lot of love//

// with TUNIOT FOR ESP8266 //

// Website: Easycoding.tn //

/////////////////////////////////

#include <ESP8266WiFi.h>

#include <ESP8266HTTPClient.h>

#include <ThingSpeak.h>

WiFiClient client;

int temp = 0 ;

String thingSpeakAddress= "http://api.thingspeak.com/update?";

String writeAPIKey;

String tsfield1Name;

String request_string;

HTTPClient http;

void setup()

{

pinMode(4, INPUT);

pinMode(0, INPUT);

pinMode(14, OUTPUT);

ThingSpeak.begin(client);

Serial.begin(9600);

WiFi.disconnect();

WiFi.begin("network name","network password");

while ((!(WiFi.status() == WL_CONNECTED))){

delay(300);

}

}

void loop()

{

temp = ThingSpeak.readIntField(625737,1,"50IRR3G5BK19NLK1");

Serial.println(temp);

delay(100);

if (digitalRead(4) == HIGH && digitalRead(0) == HIGH )

{

digitalWrite(14, HIGH);

}

else

{

digitalWrite(14, LOW);

}

if(temp >= 40 && digitalRead(4) == HIGH && digitalRead(0) == HIGH){

delay(4000);

}

delay(200);

if (client.connect("api.thingspeak.com",80)) {

request_string = thingSpeakAddress;

request_string += "key=";

request_string += "13J2H3K2GTLKYY7Z";

request_string += "&";

request_string += "field2";

request_string += "=";

request_string += digitalRead(4);

http.begin(request_string);

http.GET();

http.end();

request_string = thingSpeakAddress;

request_string += "key=";

request_string += "13J2H3K2GTLKYY7Z";

request_string += "&";

request_string += "field3";

request_string += "=";

request_string += digitalRead(0);

http.begin(request_string);

http.GET();

http.end();

delay(100);

}

}


Code2:

/////////////////////////////////

// Generated with a lot of love//

// with TUNIOT FOR ESP8266 //

// Website: Easycoding.tn //

/////////////////////////////////

#include <ESP8266WiFi.h>

#include <ESP8266HTTPClient.h>

#include <dht.h>

dht DHT;

#define DHT11_PIN 2

WiFiClient client;

String thingSpeakAddress= "http://api.thingspeak.com/update?";

String writeAPIKey;

String tsfield1Name;

String request_string;

HTTPClient http;

void setup()

{

Serial.begin(9600);

WiFi.disconnect();

WiFi.begin("network name","network password");

while ((!(WiFi.status() == WL_CONNECTED))){

delay(300);

}

}

void loop()

{

int chk = DHT.read11(DHT11_PIN);

Serial.println(DHT.temperature);

if (client.connect("api.thingspeak.com",80)) {

request_string = thingSpeakAddress;

request_string += "key=";

request_string += "13J2H3K2GTLKYY7Z";

request_string += "&";

request_string += "field1";

request_string += "=";

request_string += DHT.temperature;

http.begin(request_string);

http.GET();

http.end();

delay(400);

}

}

Mohammed Hesham Riad