91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 363KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-18
  • 語言: 其他
  • 標簽: ESP826??Arduin??MQ9??

資源簡介

樂為物聯環境監測代碼,arduinio+dht11+MQ9+火焰,AT控制ESP8266。

資源截圖

代碼片段和文件信息

//?
//?
//?

#include?“ESP8266SoftwareSerialHTTPPOST.h“
SoftwareSerial?wifi_SoftSerial(rxPin?txPin);

ESP8266SoftwareSerialHTTPPOST::ESP8266SoftwareSerialHTTPPOST()
{
wifi_SoftSerial.begin(9600);
}

int?ESP8266SoftwareSerialHTTPPOST::initESP8266()
{
int?errcnt?=?0;
if?(!doATCommand(F(“AT+CIPMODE=1“)?deftStr?deffStr?10))?{?errcnt++;?}
if?(!doATCommand(F(“AT+RST“)?deftStr?deffStr?100))?{?errcnt++;?}
if?(!doATCommand(F(“AT+CIPMUX=0“)?deftStr?deffStr?10))?{?errcnt++;?}
if?(!doATCommand(F(“AT+CWMODE=1“)?deftStr?deffStr?10))?{?errcnt++;?}
return?errcnt;
}

bool?ESP8266SoftwareSerialHTTPPOST::initWifi()
{
//測試Wifi連接
if?(!doATCommand(F(“AT+CWJAP?“)wifi_ssid?F(“No?AP“)100))?{
//連接到WIFI
if?(!doATCommand(“AT+CWJAP=\““?+?wifi_ssid?+?“\“\““?+?wifi_password?+?“\““?deftStrdeffStr10000))?{
Serial.println(F(“AT+CWJAP:ERROR:“));
Serial.println(resultLine);
return?false;
}
}
return?true;
}

bool?ESP8266SoftwareSerialHTTPPOST::httpPost()
{
bool?result?=?true;
//連接服務器
result?=?doATCommand(“AT+CIPSTART=\“TCP\“\““?+?HostAddress?+?“\““?+?HostPort?deftStr?deffStr?1000);
if?(!result)?{
Serial.println(F(“AT+CIPSTART:ERROR:“));
Serial.println(resultLine);
return?false;
}
/*
POST?/api/V1/gateway/Updatesensors/01?HTTP/1.1
userkey:e7b5ff49b74245ef905bf2150907d5cb
Host:www.lewei50.com
Content-Length:30

[{“Name“:“H1““Value“:“22“}]
*/
String?curData?=?mathData();
//Post數據
result?=?postString(“POST?“?+?HostApiPath?+?“?HTTP/1.1“?);

if?(result)?{
result?=?postString(“userkey:“?+?UserKey?);
}
if?(result)?{
result?=?postString(“Host:?“?+?HostAddress?);
}
if?(result)?{
result?=?postString(“Content-Length:“?+?(String)curData.length());
}
if?(result)?{
result?=?postString(““);
}
if?(result?)?{
result?=?postString(curData);
}
curData?=?““;
//退出透傳
doATCommand(F(“+++“)?deftStr?deffStr?20);

//關閉TCP/UDP連接
doATCommand(F(“AT+CIPCLOSE“)?deftStr?deffStr?20);

return?result;
}

bool?ESP8266SoftwareSerialHTTPPOST::doATCommand(String?cmd?String?tStr?String?fStr?unsigned?long?outTime)
{
unsigned?long?LastTime?=?0UL; //過去的時間
unsigned?long?StartTime; //開始時間
int?result?=?-1;
//發送命令
wifi_SoftSerial.println(cmd);
//等待數據返回
while?(result==-1)
{
StartTime?=?micros();
if?(wifi_SoftSerial.available()>0)?{
while?(wifi_SoftSerial.available()>0)
{
resultLine?=?wifi_SoftSerial.readStringUntil(‘\n‘)?+?‘\n‘;
//Serial.print(resultLine);
if?(resultLine.lastIndexOf(tStr)>-1)?{
result?=?0;
}
if?(resultLine.lastIndexOf(fStr)>-1)?{
result?=?1;
}
}
}
LastTime?+=?micros()-StartTime; //增加經過的時間
if?(LastTime?>?outTime*1000)?{
break;
}
}
delay(100);
return?result?==?0;
}

String?ESP8266SoftwareSerialHTTPPOST::mathData()
{
String?curData?=?“[“;
int?count?=?sizeof(infos)?/?sizeof(infos[0]);
for?(int?i?=?0;?i {

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????24119??2018-10-13?13:58??智能家居V1\Debug\board.buildinfo

?????文件???????1358??2018-07-04?11:22??智能家居V1\Debug\DHT11SimpleRead.cpp.d

?????文件???????7188??2018-07-04?11:22??智能家居V1\Debug\DHT11SimpleRead.cpp.o

?????文件???????1315??2018-10-13?13:58??智能家居V1\Debug\DHT_sensor_library\DHT.cpp.d

?????文件??????21820??2018-10-13?13:58??智能家居V1\Debug\DHT_sensor_library\DHT.cpp.o

?????文件???????1573??2018-10-13?13:58??智能家居V1\Debug\DHT_sensor_library\DHT_U.cpp.d

?????文件??????27692??2018-10-13?13:58??智能家居V1\Debug\DHT_sensor_library\DHT_U.cpp.o

?????文件???????1585??2018-10-13?13:58??智能家居V1\Debug\ESP8266SoftwareSerialHTTPPOST.cpp.d

?????文件??????38864??2018-10-13?13:58??智能家居V1\Debug\ESP8266SoftwareSerialHTTPPOST.cpp.o

?????文件???????1331??2018-07-03?20:58??智能家居V1\Debug\GP2Y10.cpp.d

?????文件???????7440??2018-07-03?20:58??智能家居V1\Debug\GP2Y10.cpp.o

?????文件???????1451??2018-10-13?13:58??智能家居V1\Debug\SoftwareSerial\SoftwareSerial.cpp.d

?????文件??????34540??2018-10-13?13:58??智能家居V1\Debug\SoftwareSerial\SoftwareSerial.cpp.o

?????文件???????1348??2018-10-13?13:58??智能家居V1\Debug\VM_DBG\VM_DBG.cpp.d

?????文件??????49592??2018-10-13?13:58??智能家居V1\Debug\VM_DBG\VM_DBG.cpp.o

?????文件????????228??2018-10-13?13:58??智能家居V1\Debug\VM_DBG\VM_mem_check_sam.cpp.d

?????文件???????1660??2018-10-13?13:58??智能家居V1\Debug\VM_DBG\VM_mem_check_sam.cpp.o

?????文件???????1810??2018-10-13?13:58??智能家居V1\Debug\智能家居V1.cpp.d

?????文件??????29388??2018-10-13?13:58??智能家居V1\Debug\智能家居V1.cpp.o

?????文件??????97064??2018-10-13?13:58??智能家居V1\Debug\智能家居V1.elf

?????文件??????39777??2018-10-13?13:58??智能家居V1\Debug\智能家居V1.hex

?????文件??????97064??2018-10-13?13:58??智能家居V1\Debug\智能家居V1.ino.elf

?????文件??????39777??2018-10-13?13:58??智能家居V1\Debug\智能家居V1.ino.hex

?????文件??????44287??2018-10-13?13:58??智能家居V1\Debug\智能家居V1.ino.with_bootloader.hex

?????文件??????44287??2018-10-13?13:58??智能家居V1\Debug\智能家居V1.with_bootloader.hex

?????文件???????3667??2018-07-03?21:29??智能家居V1\ESP8266SoftwareSerialHTTPPOST.cpp

?????文件???????1342??2018-10-13?13:46??智能家居V1\ESP8266SoftwareSerialHTTPPOST.h

?????文件???????2523??2018-07-05?07:37??智能家居V1\__vm\.智能家居V1.vsarduino.h

?????文件??????25128??2018-10-13?13:58??智能家居V1\__vm\Compile.vmps.xml

?????文件??????20553??2018-10-13?13:58??智能家居V1\__vm\Configuration.Debug.vmps.xml

............此處省略15個文件信息

評論

共有 條評論