Upload Real-time data on Cloud | ARDUINO WITH IOT | PART 8

Innovate Yourself
Innovate Yourself
45.4 هزار بار بازدید - 7 سال پیش - IN THIS VIDEO YOU WILL
IN THIS VIDEO YOU WILL LEARN HOW TO CONNECT AND USE YOUR ARDUINO TO UPLOAD THE REAL-TIME DATA ON YOUR CHANNEL THAT IT ON A WEBSITE(WWW.THINGSPEAK.COM).

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Code :
--------------------------------------------------------------------------------------------------------------------------------------------------------
int IR = A0;
float voltage;
String A = "GET /update?api_key=VX5AUWKZI5ICVYMU&field1=";
String Z = " HTTP/1.1 \nHOST: api.thingspeak.com \r\n\r\n";   //web link
void setup()
{                
Serial.begin(115200);
}
void loop()
{
/* VOLTAGE */
voltage =analogRead(IR);
voltage = (voltage / 1024.0) * 5.0;
char voltage_buff[16];
String voltageX = dtostrf(voltage, 4, 1, voltage_buff);
String postStr = A + voltageX + Z;
/*********   Uploading to ThinkSpeak Cloud    ***********/
/*********  Sending AT Commands to ESP8266    ***********/
Serial.println("AT");
delay(2000);
Serial.print("AT+CIPSTART=\"TCP\",\"api.thingspeak.com\",80\r\n");
delay(3000);
String ciplength = "AT+CIPSEND=" + String(postStr.length()) + "\r\n";
Serial.print(ciplength);
delay(3000);
Serial.print(postStr);
delay(3000);
Serial.print("AT+RST\r\n");
delay(3000);  
}

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Also follow us on Facebook:

Facebook: ashus3868

Also follow us on Instagram:

Instagram: innovateyourself2build

Also follow us on Twitter:

https://twitter.com/ashus3868?s=09
7 سال پیش در تاریخ 1396/05/12 منتشر شده است.
45,498 بـار بازدید شده
... بیشتر