|
http://www.mantech.co.za/datashe ... IELD-ESP13_KEYS.pdf
https://mouse.oit.edu.tw/Data/Program/ai/IFTTT.zip
Test.ino
#define DEBUG true
String sendData(String command, const int timeout, boolean debug){
String response = "";
Serial1.print(command); // send the read character to the esp8266
long int time = millis();
while( (time+timeout) > millis()){
while(Serial1.available()){
// The esp has data so display its output to the serial window
char c = Serial1.read(); // read the next character.
response+=c;
}
}
if(DEBUG) {
Serial.print(response);
}
return response;
}
void setup()
{
Serial.begin(115200);
while(!Serial);
Serial1.begin(115200);
sendData("AT+RST\r\n",2000,DEBUG);
sendData("AT+CWMODE=3\r\n",2000,DEBUG);
String commend = "AT+CWJAP=\"";
commend += "AP-SSID";
commend += "\",\"";
commend += "Password";
commend += "\"\r\n";
if (sendData(commend,5000,DEBUG)){
Serial.print("Join AP success\r\n");
Serial.print("IP:");
sendData("AT+CIFSR\r\n",5000,DEBUG);
sendData("AT+CIPSERVER=0\r\n",200,DEBUG);
sendData("AT+CIPMUX=0\r\n",200,DEBUG);
}
}
void loop()
{
if(Serial1.available()){
Serial.write(Serial1.read());
}
if(Serial.available()){
Serial1.write(Serial.read());
}
}
-----------------------------------------------------------------------------------------------------------------------------------------
String commends = "AT+CIPSTART=\"TCP\",\"";
commends += host;
commends += "\",";
commends += httpsPort; //443
commends += "\r\n";
sendData(commends,1000,DEBUG);
String GET = "GET /update?api_key=T6HJZN26NA26L5FU";
GET += "&field1=";
GET += DHT.temperature;
GET += "&field2=";
GET += DHT.humidity;
GET += " HTTP/1.1\r\nHost:";
GET += host;
GET += "\r\n\r\n";
Serial.println(GET);
String cipSend = "AT+CIPSEND=";
cipSend += GET.length();
cipSend += "\r\n";
sendData(cipSend,500,DEBUG);
sendData(GET,500,DEBUG);
delay(200);
sendData("AT+CIPCLOSE\r\n",500,DEBUG);
delay(1000);
sendData("AT+CIFSR\r\n",5000,DEBUG);
--------------------------------------------------------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="zh-Hant-TW"><head><meta http-equiv="content-type" content="text/html; charset=UTF-8">
<head>
<title>GET方式接收帳號與密碼</title></head>
<meta http-equiv="refresh" content="60; url=https://news.google.com.tw/">
<body>
接收的姓名為<? echo $_GET['username'];?><br>
接收的密碼為<? echo $_GET['passwd'];?><br>
</body></html>
http://127.0.0.1/test.php?username=abc&passwd=12345
Database
https://mouse.aeust.edu.tw/forum.php?mod=viewthread&tid=1125&extra=page%3D1
https://www.espressif.com/sites/ ... and_examples_en.pdf
|
本帖子中包含更多資源
您需要 登錄 才可以下載或查看,沒有帳號?立即註冊
x
|