我制作了一个温度传感器,可以将温度发送到 Thingspeak,如果温度超过 28 度,我也希望它发送和发送
电子邮件,但我不知道如何做 https 部分,我发现的教程不起作用或我听不懂。
我已经有一个链接,如果我打开 (ifttt),它会发送一封电子邮件,但我无法让 esp8266 打开链接。
有人可以帮我在if 循环
中需要什么,还是我做的完全错了?谢谢你的帮助。
代码:
全选#include
#include
#include
#include
#define ONE_WIRE_BUS 5
#define TEMPERATURE_PRECISION 10
unsigned long myChannelNumber = 1;
const char * myWriteAPIKey="xxxxx";
const char* ssid= "xxxxx";
const char* password= "xxxxx";
const char* host = "maker.ifttt.com";
int fieldStart = 1;
int status = WL_IDLE_STATUS;
WiFiClient client;
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
int numberOfDevices;
DeviceAddress tempDeviceAddress;
void setup() {
Serial.begin(115200);
delay(100);
Serial.println();
Serial.println();
pinMode(A0,INPUT);
Serial.print("Connec
ting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
ThingSpeak.begin(client);
sensors.begin();
numberOfDevices = sensors.getDeviceCount();
Serial.print("Locating devices...");
Serial.print("Found ");
Serial.print(numberOfDevices, DEC);
Serial.println(" devices.");
Serial.print("Parasite power is: ");
if (sensors.isParasitePowerMode()) Serial.println("ON");
else Serial.println("OFF");
for(int i=0;i28){
}
delay(15000);}}