อัพโค้ด ลง NodeMcu V3 CH340 Lua WIFI ESP8266-12E แล้วขึ้น Error compiling for board NodeMCU 1.0 (ESP-12E Module).

ขึ้นแบบนี้
In file included from C:\Users\Admin\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.cpp:15:0:

C:\Users\Admin\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.h:36:29: fatal error: Adafruit_Sensor.h: No such file or directory

#include

^

compilation terminated.

exit status 1

Error compiling for board NodeMCU 1.0 (ESP-12E Module).

///โค้ด////
void Line_Notify1(String message1) ;

#include

#include

#define WIFI_SSID "TYH" /////////////*************แก้

#define WIFI_PASSWORD "bacq96812"////////**************แก้

#define LINE_TOKEN_PIR "4yjuf4qYSavNKMSjktnax2hxilK6ognI6E5gap3rbA5"////***************แก้

#define PirPin D6

#define DHTPIN D7

#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

String message1 = "%E0%B8%A1%E0%B8%B5%E0%B9%80%E0%B8%AD%";//****************แก้

bool beep_state = false;

bool send_state = false;

uint32_t ts, ts1, ts2;

void setup() {

Serial.begin(115200);

Serial.println();

pinMode(PirPin, INPUT);

pinMode(LED_BUILTIN, OUTPUT);

digitalWrite(LED_BUILTIN, HIGH);

dht.begin();

Serial.println("connecting");

WiFi.mode(WIFI_STA);

WiFi.begin(WIFI_SSID, WIFI_PASSWORD);

Serial.print("connecting");

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

Serial.print(".");

delay(500);

}

Serial.println();

Serial.print("connected: ");

Serial.println(WiFi.localIP());

delay(10000);

Serial.println("Pir Ready!!");

read_sensor();

ts = ts1 = ts2 = millis();

}

void loop() {

ts = millis();

if (WiFi.status() == WL_CONNECTED) {

digitalWrite(LED_BUILTIN, LOW);

} else {

digitalWrite(LED_BUILTIN, HIGH);

}

if ((ts - ts2 >= 60000) && (WiFi.status() == WL_CONNECTED)) {

read_sensor();

}

if ((ts - ts1 >= 5000) && (beep_state == true)) {

beep_state = false;

}

if ((digitalRead(PirPin) == HIGH) && (beep_state == false) && (WiFi.status() == WL_CONNECTED)) {

while (digitalRead(PirPin) == HIGH) delay(100);

Serial.println("Detect !");

Line_Notify1(message1);

beep_state = true;

}

delay(10);

}

void Line_Notify1(String message) {

WiFiClientSecure client;

if (!client.connect("notify-api.line.me", 443)) {

Serial.println("connection failed");

delay(2000);

return;

}

String req = "";

req += "POST /api/notify HTTP/1.1\r\n";

req += "Host: notify-api.line.me\r\n";

req += "Authorization: Bearer " + String(LINE_TOKEN_PIR) + "\r\n";

req += "Cache-Control: no-cache\r\n";

req += "User-Agent: ESP8266\r\n";

req += "Content-Type: application/x-www-form-urlencoded\r\n";

req += "Content-Length: " + String(String("message=" + message1).length()) + "\r\n";

req += "\r\n";

req += "message=" + message1;

// Serial.println(req);

client.print(req);

delay(20);

while (client.connected()) {

String line = client.readStringUntil('\n');

if (line == "\r") {

break;

}

}

}

void read_sensor() {

float h = dht.readHumidity();

float t = dht.readTemperature();

if (isnan(h) || isnan(t)) {

Serial.println("Failed to read from DHT sensor!");

return;

}

Serial.print("Temperature: ");

Serial.print(t);

Serial.println(" *C ");

}
แก้ไขข้อความเมื่อ
แสดงความคิดเห็น
โปรดศึกษาและยอมรับนโยบายข้อมูลส่วนบุคคลก่อนเริ่มใช้งาน อ่านเพิ่มเติมได้ที่นี่