ขึ้นเเบบนี้มีอะไรผิดครับ exit status 1 Error compiling for board NodeMCU 1.0 (ESP-12E Module)

#define BLYNK_TEMPLATE_ID "TMPL6r9MX7k0g"
#define BLYNK_DEVICE_NAME "DHT"

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <TridentTD_LineNotify.h>
#include <BlynkSimpleEsp8266.h>
#include "DHT.h"
DHT dht;
int analogPin = A0; //ประกาศตัวแปร
int val = 0;

#define LINE_TOKEN "5LeQd7C9ONP4DC32tqP63qo9XMUNWRl3Fi9DzuYh9Dh"

char auth[] = "FqO0_6irvdX4VCYQt1na0FVsa7o5H5Pn"; // ใช้ Token ที่คัดลอกจากแอพเรามาวางแทน
char ssid[] = "Def_2G";
char pass[] = "0817664814"; // กรอกรหัส WIFI แทนนะครับ

bool notifiedRain = false, notifiedHarvest = false;


void setup()
{
    // Debug console
    Serial.begin(9600);

    Blynk.begin(auth, ssid, pass, "blynk.iot-cm.com", 8080);

    LINE.setToken(LINE_TOKEN);
    Serial.println();
    Serial.println("Status\tHumidity (%)\tTemperature (C)\t(F)");
    dht.setup(D2); // data pin 2
    pinMode(analogPin, INPUT);
}

void loop()
{
    delay(dht.getMinimumSamplingPeriod());
    float humidity = dht.getHumidity();       // ดึงค่าความชื้น
    float temperature = dht.getTemperature(); // ดึงค่าอุณหภูมิ
    float H = humidity ;
    Serial.print(dht.getStatusString());
    Serial.print("\t");
    Serial.print(H, 1);
    Serial.print("\t\t");
    Serial.print(temperature, 1);
    Serial.print("\t\t");
    Serial.println(dht.toFahrenheit(temperature), 1);
    Blynk.run();
    delay(100);
    Blynk.virtualWrite(V0, temperature);
    Blynk.virtualWrite(V1, H);
    // LINE.notify("Humidity is: "+String(humidity)+" %");
    // LINE.notify("Temperature is: "+String(temperature)+" C");
    val = analogRead(analogPin); //อ่านค่าสัญญาณ analog ที่ต่อกับ LDR
    val = map(val, 0, 1024, 0, 100);
    Serial.print("val = "); // พิมพ์ข้อมความส่งเข้าคอมพิวเตอร์ "val = "
    Serial.println(val);    // พิมพ์ค่าของตัวแปร val
    Blynk.virtualWrite(V2, val);
    // LINE.notify("Rain is: "+String(val)+" %");
    if (H > 60)
    {
        if (!notifiedHarvest)
        {
            LINE.notify("อุณหภูมิไม่เหมาะสมเเก่การเก็บผลผลิต" + String(humidity) + " %");
            // delay(1000);
            notifiedHarvest = true;
        }
    }
    else
    {
        notifiedHarvest = false;
    }

    if (val < 40)
    {
        if (!notifiedRain)
        {
            LINE.notify("มีฝนตกไม่เหมาะสมต่อการกรีดยาง");
            notifiedRain = true;
        }
    }
    else
    {
        notifiedRain = false;
    }
    //   int rain = analogRead(D3);
    // rain = map(rain,0,1023,0,100);
    // Blynk.virtualWrite(V3,rain);
    //  Serial.println(rain);
}
Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Invalid library found in D:\New folder\libraries\ESP32Ping: no headers files (.h) found in D:\New folder\libraries\ESP32Ping

Invalid library found in D:\New folder\libraries\FastLED: no headers files (.h) found in D:\New folder\libraries\FastLED

Invalid library found in D:\New folder\libraries\HMC5883L: no headers files (.h) found in D:\New folder\libraries\HMC5883L

Invalid library found in D:\New folder\libraries\libraries: no headers files (.h) found in D:\New folder\libraries\libraries

Invalid library found in D:\New folder\libraries\pzem: no headers files (.h) found in D:\New folder\libraries\pzem

Invalid library found in D:\New folder\libraries\SHT1x: no headers files (.h) found in D:\New folder\libraries\SHT1x

Invalid library found in D:\New folder\libraries\ESP32Ping: no headers files (.h) found in D:\New folder\libraries\ESP32Ping

Invalid library found in D:\New folder\libraries\FastLED: no headers files (.h) found in D:\New folder\libraries\FastLED

Invalid library found in D:\New folder\libraries\HMC5883L: no headers files (.h) found in D:\New folder\libraries\HMC5883L

Invalid library found in D:\New folder\libraries\libraries: no headers files (.h) found in D:\New folder\libraries\libraries

Invalid library found in D:\New folder\libraries\pzem: no headers files (.h) found in D:\New folder\libraries\pzem

Invalid library found in D:\New folder\libraries\SHT1x: no headers files (.h) found in D:\New folder\libraries\SHT1x

Invalid library found in D:\New folder\libraries\ESP32Ping: no headers files (.h) found in D:\New folder\libraries\ESP32Ping

Invalid library found in D:\New folder\libraries\FastLED: no headers files (.h) found in D:\New folder\libraries\FastLED

Invalid library found in D:\New folder\libraries\HMC5883L: no headers files (.h) found in D:\New folder\libraries\HMC5883L

Invalid library found in D:\New folder\libraries\libraries: no headers files (.h) found in D:\New folder\libraries\libraries

Invalid library found in D:\New folder\libraries\pzem: no headers files (.h) found in D:\New folder\libraries\pzem

Invalid library found in D:\New folder\libraries\SHT1x: no headers files (.h) found in D:\New folder\libraries\SHT1x

Invalid library found in D:\New folder\libraries\ESP32Ping: no headers files (.h) found in D:\New folder\libraries\ESP32Ping

Invalid library found in D:\New folder\libraries\FastLED: no headers files (.h) found in D:\New folder\libraries\FastLED

Invalid library found in D:\New folder\libraries\HMC5883L: no headers files (.h) found in D:\New folder\libraries\HMC5883L

Invalid library found in D:\New folder\libraries\libraries: no headers files (.h) found in D:\New folder\libraries\libraries

Invalid library found in D:\New folder\libraries\pzem: no headers files (.h) found in D:\New folder\libraries\pzem

Invalid library found in D:\New folder\libraries\SHT1x: no headers files (.h) found in D:\New folder\libraries\SHT1x

Invalid library found in D:\New folder\libraries\ESP32Ping: no headers files (.h) found in D:\New folder\libraries\ESP32Ping

Invalid library found in D:\New folder\libraries\FastLED: no headers files (.h) found in D:\New folder\libraries\FastLED

Invalid library found in D:\New folder\libraries\HMC5883L: no headers files (.h) found in D:\New folder\libraries\HMC5883L

Invalid library found in D:\New folder\libraries\libraries: no headers files (.h) found in D:\New folder\libraries\libraries

Invalid library found in D:\New folder\libraries\pzem: no headers files (.h) found in D:\New folder\libraries\pzem

Invalid library found in D:\New folder\libraries\SHT1x: no headers files (.h) found in D:\New folder\libraries\SHT1x

Invalid library found in D:\New folder\libraries\ESP32Ping: no headers files (.h) found in D:\New folder\libraries\ESP32Ping

Invalid library found in D:\New folder\libraries\FastLED: no headers files (.h) found in D:\New folder\libraries\FastLED

Invalid library found in D:\New folder\libraries\HMC5883L: no headers files (.h) found in D:\New folder\libraries\HMC5883L

Invalid library found in D:\New folder\libraries\libraries: no headers files (.h) found in D:\New folder\libraries\libraries

Invalid library found in D:\New folder\libraries\pzem: no headers files (.h) found in D:\New folder\libraries\pzem

Invalid library found in D:\New folder\libraries\SHT1x: no headers files (.h) found in D:\New folder\libraries\SHT1x

Invalid library found in D:\New folder\libraries\ESP32Ping: no headers files (.h) found in D:\New folder\libraries\ESP32Ping

Invalid library found in D:\New folder\libraries\FastLED: no headers files (.h) found in D:\New folder\libraries\FastLED

Invalid library found in D:\New folder\libraries\HMC5883L: no headers files (.h) found in D:\New folder\libraries\HMC5883L

Invalid library found in D:\New folder\libraries\libraries: no headers files (.h) found in D:\New folder\libraries\libraries

Invalid library found in D:\New folder\libraries\pzem: no headers files (.h) found in D:\New folder\libraries\pzem

Invalid library found in D:\New folder\libraries\SHT1x: no headers files (.h) found in D:\New folder\libraries\SHT1x

Invalid library found in D:\New folder\libraries\ESP32Ping: no headers files (.h) found in D:\New folder\libraries\ESP32Ping

Invalid library found in D:\New folder\libraries\FastLED: no headers files (.h) found in D:\New folder\libraries\FastLED

Invalid library found in D:\New folder\libraries\HMC5883L: no headers files (.h) found in D:\New folder\libraries\HMC5883L

Invalid library found in D:\New folder\libraries\libraries: no headers files (.h) found in D:\New folder\libraries\libraries

Invalid library found in D:\New folder\libraries\pzem: no headers files (.h) found in D:\New folder\libraries\pzem

Invalid library found in D:\New folder\libraries\SHT1x: no headers files (.h) found in D:\New folder\libraries\SHT1x

Invalid library found in D:\New folder\libraries\ESP32Ping: no headers files (.h) found in D:\New folder\libraries\ESP32Ping

Invalid library found in D:\New folder\libraries\FastLED: no headers files (.h) found in D:\New folder\libraries\FastLED

Invalid library found in D:\New folder\libraries\HMC5883L: no headers files (.h) found in D:\New folder\libraries\HMC5883L

Invalid library found in D:\New folder\libraries\libraries: no headers files (.h) found in D:\New folder\libraries\libraries

Invalid library found in D:\New folder\libraries\pzem: no headers files (.h) found in D:\New folder\libraries\pzem

Invalid library found in D:\New folder\libraries\SHT1x: no headers files (.h) found in D:\New folder\libraries\SHT1x

Invalid library found in D:\New folder\libraries\ESP32Ping: no headers files (.h) found in D:\New folder\libraries\ESP32Ping

Invalid library found in D:\New folder\libraries\FastLED: no headers files (.h) found in D:\New folder\libraries\FastLED

Invalid library found in D:\New folder\libraries\HMC5883L: no headers files (.h) found in D:\New folder\libraries\HMC5883L

Invalid library found in D:\New folder\libraries\libraries: no headers files (.h) found in D:\New folder\libraries\libraries

Invalid library found in D:\New folder\libraries\pzem: no headers files (.h) found in D:\New folder\libraries\pzem

Invalid library found in D:\New folder\libraries\SHT1x: no headers files (.h) found in D:\New folder\libraries\SHT1x

Invalid library found in D:\New folder\libraries\ESP32Ping: no headers files (.h) found in D:\New folder\libraries\ESP32Ping

Invalid library found in D:\New folder\libraries\FastLED: no headers files (.h) found in D:\New folder\libraries\FastLED

Invalid library found in D:\New folder\libraries\HMC5883L: no headers files (.h) found in D:\New folder\libraries\HMC5883L

Invalid library found in D:\New folder\libraries\libraries: no headers files (.h) found in D:\New folder\libraries\libraries

Invalid library found in D:\New folder\libraries\pzem: no headers files (.h) found in D:\New folder\libraries\pzem

Invalid library found in D:\New folder\libraries\SHT1x: no headers files (.h) found in D:\New folder\libraries\SHT1x





















In file included from D:\New folder\libraries\blynk-library-master\src/BlynkApiArduino.h:14,

                 from D:\New folder\libraries\blynk-library-master\src/BlynkSimpleEsp8266.h:24,

                 from D:\sketch_jul31a\sketch_jul31a1\sketch_jul31a1.ino:8:

D:\New folder\libraries\blynk-library-master\src/Blynk/BlynkApi.h:39:6: error: #error "Please specify your BLYNK_TEMPLATE_ID and BLYNK_TEMPLATE_NAME"

   39 |     #error "Please specify your BLYNK_TEMPLATE_ID and BLYNK_TEMPLATE_NAME"

      |      ^~~~~

Multiple libraries were found for "Adafruit_Sensor.h"

 Used: D:\New folder\libraries\Adafruit_Sensor-master

 Not used: D:\New folder\libraries\Adafruit_Unified_Sensor

Multiple libraries were found for "ESP8266WiFi.h"

 Used: D:\New folder\libraries\ESP8266WiFi

 Not used: C:\Users\Dell\OneDrive\เอกสาร\ArduinoData\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi

Multiple libraries were found for "BlynkSimpleEsp8266.h"

 Used: D:\New folder\libraries\blynk-library-master

 Not used: D:\New folder\libraries\Blynk-1.3.0

 Not used: D:\New folder\libraries\Blynk

Multiple libraries were found for "DHT.h"

 Used: D:\New folder\libraries\DHT

 Not used: D:\New folder\libraries\esp826611

 Not used: D:\New folder\libraries\DHT-sensor-library-master

exit status 1

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



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

ตามไปลบ folder พวกนี้ออกให้หมดครับ

image

วางไฟล์ซ้อนกันหลายที่รอบบมันงงว่าจะใช้อันไหน

กำหนดอะไรผิดป่าวครับตัวอย่างที่เขาเซตต้องแบบนี้

image

#define BLYNK_TEMPLATE_ID "YourTemplateID"
#define BLYNK_TEMPLATE_NAME "YourTemplateName"

ให้คุณแทนที่ YourTemplateID และ YourTemplateName ด้วยค่าที่แท้จริงจาก Template ของคุณ

รบกวนพีี่หน่อยนะครับ ขอบคุณพี่มากนะครับ

ลบออก

ที่เขียนการใช้เซ็นเซอร์มาน่าจะผิดนะ ลองเอาตัวอย่างไปแกะดู

#include "DHT.h"

// กำหนดพินที่ต่อกับ DATA ของเซ็นเซอร์
#define DHTPIN 2     // ต่อ DATA กับขา 2 ของ Arduino

// กำหนดชนิดของเซ็นเซอร์ที่ใช้ (DHT11 หรือ DHT22)
#define DHTTYPE DHT11   // DHT11 หรือ DHT22 ก็ได้

DHT dht(DHTPIN, DHTTYPE);

void setup() {
  // เริ่มต้น Serial Monitor
  Serial.begin(9600);
  Serial.println("DHT Sensor Test!");

  // เริ่มต้นเซ็นเซอร์ DHT
  dht.begin();
}

void loop() {
  // รอให้เซ็นเซอร์พร้อมทำงาน
  delay(2000);

  // อ่านค่าความชื้น (humidity)
  float h = dht.readHumidity();

  // อ่านค่าอุณหภูมิเป็นองศาเซลเซียส (temperature)
  float t = dht.readTemperature();

  // ตรวจสอบว่าค่าอ่านได้ถูกต้องหรือไม่
  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  // แสดงผลความชื้นและอุณหภูมิที่อ่านได้
  Serial.print("Humidity: ");
  Serial.print(h);
  Serial.print(" %\t");
  Serial.print("Temperature: ");
  Serial.print(t);
  Serial.println(" *C");
}
Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"





















In file included from D:\New folder\libraries\ESP8266WiFi\src/ESP8266WiFi.h:39,

                 from C:\Users\Dell\OneDrive\Desktop\sketch_jan11a\sketch_jan11a.ino:7:

D:\New folder\libraries\ESP8266WiFi\src/WiFiClient.h:89:10: error: conflicting return type specified for 'virtual size_t WiFiClient::availableForWrite()'

   89 |   size_t availableForWrite();

      |          ^~~~~~~~~~~~~~~~~

In file included from C:\Users\Dell\OneDrive\�͡���\ArduinoData\packages\esp8266\hardware\esp8266\3.1.2\cores\esp8266/Stream.h:27,

                 from C:\Users\Dell\OneDrive\�͡���\ArduinoData\packages\esp8266\hardware\esp8266\3.1.2\cores\esp8266/HardwareSerial.h:32,

                 from C:\Users\Dell\OneDrive\�͡���\ArduinoData\packages\esp8266\hardware\esp8266\3.1.2\cores\esp8266/Arduino.h:303,

                 from sketch\sketch_jan11a.ino.cpp:1:

C:\Users\Dell\OneDrive\�͡���\ArduinoData\packages\esp8266\hardware\esp8266\3.1.2\cores\esp8266/Print.h:80:21: note: overridden function is 'virtual int Print::availableForWrite()'

   80 |         virtual int availableForWrite() { return 0; }

      |                     ^~~~~~~~~~~~~~~~~

exit status 1

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



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

วางโค้ตเต็มให้ดูหน่อย

ข้อผิดพลาดนี้เกิดจากการกำหนดชนิดข้อมูลที่ขัดแย้งกันระหว่างฟังก์ชัน availableForWrite() ในไลบรารี ESP8266WiFi และ Print โดยในไลบรารี ESP8266WiFi ฟังก์ชันนี้คืนค่าเป็น size_t แต่ในไลบรารี Print ฟังก์ชันเดียวกันคืนค่าเป็น int ซึ่งทำให้เกิดการขัดแย้งเมื่อคอมไพล์โค้ด

วิธีแก้ปัญหา:

อัปเดตไลบรารีและบอร์ด ESP8266:

  • ลองอัปเดตไลบรารี ESP8266WiFi และบอร์ด ESP8266 ใน Arduino IDE ให้เป็นเวอร์ชันล่าสุด:
    • ไปที่ Tools > Manage Libraries… และค้นหา “ESP8266WiFi” จากนั้นทำการอัปเดตไลบรารี
    • ไปที่ Tools > Board > Boards Manager ค้นหา “esp8266” และตรวจสอบให้แน่ใจว่าใช้เวอร์ชันล่าสุดของบอร์ด ESP8266
#define BLYNK_TEMPLATE_ID "TMPL6v1XK74Bq"
#define BLYNK_TEMPLATE_NAME "เเจงเตอนฝนตก"

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <TridentTD_LineNotify.h>
#include <BlynkSimpleEsp8266.h>
#include "DHT.h"
DHT dht;
int analogPin = A0; 
int val = 0;

#define LINE_TOKEN "ku6k9QNq8o8OVDmwSJ0lYZkBylM7J189klcSv5H8D9M"
char auth[] = "u1UTwWX4VAta2iZmdNZg1rbn9eNgZ9VT"; 
char ssid[] = "SPTWIFI";
char pass[] = "spt12345678"; 

bool notifiedRain = false, notifiedHarvest = false;

// void moisture(){
//   int rain = analogRead(D3);
//   rain = map(rain,0,1023,0,100);
//   Blynk.virtualWrite(V3,rain);
//
//   }
// int anlogpin = D3;
// int val = 0;

void setup()
{
    // Debug console
    Serial.begin(9600);

    Blynk.begin(auth, ssid, pass);
    LINE.setToken(LINE_TOKEN);
    Serial.println();
    Serial.println("Status\tHumidity (%)\tTemperature (C)\t(F)");
    dht.setup(4); 
    pinMode(analogPin, INPUT);
}

void loop()
{
    Blynk.run();
    delay(dht.getMinimumSamplingPeriod());
    float humidity = dht.getHumidity();       
    float temperature = dht.getTemperature(); 
    float H = humidity;
    Serial.print(dht.getStatusString());
    Serial.print("\t");
    Serial.print(H, 1);
    Serial.print("\t\t");
    Serial.print(temperature, 1);
    Serial.print("\t\t");
    Serial.println(dht.toFahrenheit(temperature), 1);
    Blynk.run();
    delay(100);
    Blynk.virtualWrite(V0, temperature);
    Blynk.virtualWrite(V1, H);
    val = analogRead(analogPin); //อ่านค่าสัญญาณ analog ที่ต่อกับ LDR
    val = map(val, 0, 1024, 0, 100);
    Serial.print("val = "); 
    Serial.println(val);    
    Blynk.virtualWrite(V2, val);
    if (H > 60)
    {
        if (!notifiedHarvest)
        {
            LINE.notify("มีโอกาสเกิดฝนตก" + String(humidity) + " %");
            notifiedHarvest = true;
        }
    }
    else
    {
        notifiedHarvest = false;
    }

    if (val < 100)
    {
        if (!notifiedRain)
        {
            LINE.notify("มีฝนตก");
            notifiedRain = true;
        }
    }
    else
    {
        notifiedRain = false;
    }
    if (temperature >24&&temperature<=28)
    {
       if (!notifiedRain)
       {
           LINE.notify("อุณหภูมิเหมาะสมต่อการเก็บเกี่ยวผลผลิต");
           notifiedRain = true;
       }
   }
   else
    {
        notifiedRain = false;
    }
    //   int rain = analogRead(D3);
    // rain = map(rain,0,1023,0,100);
    // Blynk.virtualWrite(V3,rain);
    //  Serial.println(rain)
    }