Arduino ขึ้น fatal error: avr/eeprom.h แก้ไข้ยังไงดีครับ

ผมทำโปรเจคที่จารหมอบหมายครับ เป็นโปรแกรมให้ ESP8266 ต่อกับ Netpie และแจ้งใน Line ครับ
Library ปกติผมใช้ใน Drive G ของเครื่องผมครับ
ผมใช้ ESP8266


นี้คือที่ขึ้น Error ครับ

Alternatives for avr/eeprom.h: []G:\Arduino\libraries\EEPROM\EEPROM.cpp:24:10: fatal error: avr/eeprom.h: No such file or directory

   24 | #include <avr/eeprom.h>

ResolveLibrary(avr/eeprom.h)      |          ^~~~~~~~~~~~~~

compilation terminated.

  -> candidates: []

exit status 1

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


นี่คือโค้ดที่ไปหามาแล้วลองทำครับ

// NETPIE FREEBOARD's TEST LED CODE BY NECTEC/NARIN BANNASAN
#include <AuthClient.h>
#include <MicroGear.h> //
#include <MQTTClient.h>
#include <Arduino.h>
#include <ESP8266WiFi.h> //
#include <EEPROM.h> //
#include <Wire.h> //
#include <WiFiManager.h> //
#include <TridentTD_LineNotify.h> //

const char* ssid     = "88_WIFI_2.4G";           //== 1 == ใส่ชื่อเครือข่าย WiFi ที่จะให้ NodeMCU V2 เชื่อมต่อ
const char* password = "1212312121";            //== 2 == ใส่รหัสผ่านของเครือข่าย WiFi ที่จะให้ NodeMCU V2 เชื่อมต่อ

#define APPID       "EverythingWithESP"         //== 3 == ใส่ Application ID (ชื่อ Application) ที่สร้างบน NETPIE
#define GEARKEY     "5HMxRRaoGqTnVxe"             //== 4 == ใส่ Key ของอุปกรณ์ ที่ได้จากการสร้างบน NETPIE
#define GEARSECRET  "3CFagExMesWFl5TEW1PYvt4dK"   //== 5 == ใส่ Secret ของอุปกรณ์ ที่ได้จากการสร้างบน NETPIE
#define ALIAS       "64543209010-0"                         //== 6 == ตั้งชื่อ Alias ให้กับ Things นี้ (รหัสนักศึกษา)
#define SCOPE       ""
#define LINE_TOKEN  "e5K3rcvdZIibBIhTwx2YQUPLKpygfSaEIQ3ZdWJncs2"    //== 7 == TOKEN of LINE Notify

WiFiClient client;
AuthClient *authclient;
MicroGear microgear(client);

void onConnected(char *attribute, uint8_t* msg, unsigned int msglen)
{
  Serial.println("Connected to NETPIE...");
  microgear.setAlias(ALIAS);
}

void onMsghandler(char *topic, uint8_t* msg, unsigned int msglen)
{
  Serial.print("Incoming message --> ");  
  Serial.print(topic);
  Serial.print(" : ");
  char strState[msglen];
  for (int i = 0; i < msglen; i++)
  {
    strState[i] = (char)msg[i];
    Serial.print((char)msg[i]);
  }
  Serial.println();
  String stateStr = String(strState).substring(0, msglen);
  //=========== ช่วงประมวลผลคำสั่ง =============
  if (stateStr == "ON")
  {
    digitalWrite(LED_BUILTIN, LOW);
    microgear.chat("led", "ON");        //==== คำสั่ง chat เพื่อบอกส่งค่าสถานะไปยังหลอด LED บน NETPIE Freeboard
    LINE.notify("เปิด");
//    LINE.notify("ความความดัน " + String(P) + " x10^3 Pa");
//    LINE.notify("อุณหภูมิ " + String(T) + " *C");
//    LINE.notify("ความชื้น " + String(RH) + " %");
  }
  else if (stateStr == "OFF")
  {
    digitalWrite(LED_BUILTIN, HIGH);
    microgear.chat("led", "OFF");       //==== คำสั่ง chat เพื่อบอกส่งค่าสถานะไปยังหลอด LED บน NETPIE Freeboard
    LINE.notify("ปิด");
//    LINE.notify("ความความดัน " + String(P) + " x10^3 Pa");
//    LINE.notify("อุณหภูมิ " + String(T) + " *C");
//    LINE.notify("ความชื้น " + String(RH) + " %");
  }
  //=========== ช่วงประมวลผลคำสั่ง  =============
}
//LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);
//  lcd.clear();
//  lcd.init();
//  lcd.backlight();
  Serial.begin(9600);
//  if (!bme.begin(0x76)) {
//    Serial.println("Could not find a valid BME280 sensor, check wiring!");
//    while (1);
//  }
  Serial.println("Starting...");
  //  pinMode(LEDPin, OUTPUT);
  microgear.on(MESSAGE, onMsghandler);
  microgear.on(CONNECTED, onConnected);
  //ฟังชั่น smartconfig------------------------------
  //  WiFiManager wifiManager;
  //  wifiManager.autoConnect("LowCostSmartFarm021");
  //  Serial.println("connected finish");
  //-----------------------------------------------
  if (WiFi.begin(ssid, password))
  {
    while (WiFi.status() != WL_CONNECTED)
    {
      delay(500);
      Serial.print(".");
    }
    Serial.println("WiFi connected");
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());
    Serial.println(LINE.getVersion());
    LINE.setToken(LINE_TOKEN);
    //uncomment the line below if you want to reset token -->
    microgear.resetToken();
    microgear.init(GEARKEY, GEARSECRET, SCOPE);
    microgear.connect(APPID);
  }
}
void loop()
{
  if (microgear.connected())
  {
    microgear.loop();
    Serial.println("connect...");
//    microgear.chat("bmeT", T);
//    microgear.chat("bmeP", P);
//    microgear.chat("bmeRH", RH);
    microgear.chat("led", digitalRead(LED_BUILTIN));
    delay(1000);
  }
  else
  {
    Serial.println("connection lost, reconnect...");
    microgear.connect(APPID);
  }
  //  delay(1000);

//  T = bme.readTemperature();
//  P = bme.readPressure() / 1000.0;
//  RH = bme.readHumidity();
//  lcd.setCursor(0, 0); lcd.print("T ="); lcd.setCursor(9, 0); lcd.print("*C");
//  lcd.setCursor(4, 0); lcd.print(T);
//  lcd.setCursor(0, 1); lcd.print("RH =");
//  lcd.setCursor(4, 1); lcd.print(RH); lcd.setCursor(9, 1); lcd.print("%");
//  lcd.setCursor(0, 2); lcd.print("P ="); lcd.setCursor(9, 2); lcd.print("Pa");
//  lcd.setCursor(4, 2); lcd.print(P);
  //        if (T >= 30) {
  //          digitalWrite(LED_BUILTIN, LOW);
  //          delay(1000);
  //        }
  //        else
  //          digitalWrite(LED_BUILTIN,HIGH);
  //        delay(1000);
  //  }
  //  else
  //  {
  //    lcd.clear();
  //    Serial.println("Measuring failed.");
  //    lcd.setCursor(3, 1); lcd.print("Measuring failed.");

  delay(1000);

}

ขอบคุณครับผม

ลง library EEPROM ยังครับ

ลงแล้วครับผม แต่ไม่แน่ใจว่าเป็น Version ไหนครับ

ลงผิดที่ครับ ต้องไปลงในนี้ C:\Users\PC Name\Documents\Arduino\libraries Cut ไปทั้ง โฟล์เดอร์เลยก็ได้

ต้องลงใน Documents ของ Drive C หรอครับ เพราะว่าผมติดตั้ง Arduino ใน Drive E ครับ Libraly ก็ใช้ใน Drive E ครับ ใน Documents ผมไม่มีของ Arduino เลยครับ

ถ้างั้นกลับไปที่เดิม แล้วเปลี่ยนชื่อ EEPROM เป็น EEPROM-master

ขึ้นแบบนี้ครับ

Alternatives for avr/eeprom.h: []
G:\Arduino\libraries\EEPROM-master\EEPROM.cpp:24:10: fatal error: avr/eeprom.h: No such file or directoryResolveLibrary(avr/eeprom.h)

  -> candidates: []   24 | #include <avr/eeprom.h>

      |          ^~~~~~~~~~~~~~
compilation terminated.
Using library ESP8266_Microgear at version 1.2.3 in folder: G:\Arduino\libraries\ESP8266_Microgear 
Using library ESP8266WiFi at version 1.0 in folder: G:\Arduino\libraries\ESP8266WiFi 
Using library EEPROM-master in folder: G:\Arduino\libraries\EEPROM-master (legacy)
Using library Wire at version 1.0 in folder: G:\Arduino\libraries\Wire 
Using library WiFiManager at version 0.11 in folder: G:\Arduino\libraries\WiFiManager 
Using library ESP8266WebServer at version 1.0 in folder: G:\Arduino\libraries\ESP8266WebServer 
Using library DNSServer---esp32-master at version 1.1.0 in folder: G:\Arduino\libraries\DNSServer---esp32-master 
Using library TridentTD_Linenotify at version 3.0.1 in folder: G:\Arduino\libraries\TridentTD_Linenotify 
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

และก็ขึ้น Invalid library found in G:\Arduino\libraries\ หลายอันเลยครับ

Invalid library found in G:\Arduino\libraries\ADS1115: no headers files (.h) found in G:\Arduino\libraries\ADS1115

ใช้วิธีไหนติดตั้ง library

Copy Library ที่อาจารย์บีบไฟล์มาให้ไปวางในโฟล์เดอร์เลยครับผม

ลองลบออกแล้ว เข้าไปติดตั้งจาก Library menager

ตอนนี้ขึ้น Error แบบนี้ครับ

Alternatives for ESP8266WiFi.h: [ESP8266WiFi@1.0]

ResolveLibrary(ESP8266WiFi.h)

  -> candidates: [ESP8266WiFi@1.0]

"C:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\3.0.4-gcc10.3-1757bed/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -D_GNU_SOURCE "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/include" "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/lwip2/include" "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\\Users\\LENOVO\\AppData\\Local\\Temp\\arduino_build_259764/core" -c -w -Werror=return-type -Os -g -free -fipa-pta -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++17 -ffunction-sections -fdata-sections -fno-exceptions -DMMU_IRAM_SIZE=0x8000 -DMMU_ICACHE_SIZE=0x8000 -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10815 -DARDUINO_ESP8266_NODEMCU_ESP12E -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_NODEMCU_ESP12E\"" -DLED_BUILTIN=2 -DFLASHMODE_DIO -DESP8266 "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2\\cores\\esp8266" "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2\\variants\\nodemcu" "-IG:\\Arduino\\libraries\\ESP8266_Microgear" "-IG:\\Arduino\\libraries\\ESP8266WiFi\\src" "C:\\Users\\LENOVO\\AppData\\Local\\Temp\\arduino_build_259764\\sketch\\20190824NodeMCU_LED_NetPie_LINE_2018009OK.ino.cpp" -o nul

Alternatives for EEPROM.h: [EEPROM]

ResolveLibrary(EEPROM.h)

  -> candidates: [EEPROM]

"C:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\3.0.4-gcc10.3-1757bed/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -D_GNU_SOURCE "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/include" "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/lwip2/include" "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\\Users\\LENOVO\\AppData\\Local\\Temp\\arduino_build_259764/core" -c -w -Werror=return-type -Os -g -free -fipa-pta -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++17 -ffunction-sections -fdata-sections -fno-exceptions -DMMU_IRAM_SIZE=0x8000 -DMMU_ICACHE_SIZE=0x8000 -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10815 -DARDUINO_ESP8266_NODEMCU_ESP12E -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_NODEMCU_ESP12E\"" -DLED_BUILTIN=2 -DFLASHMODE_DIO -DESP8266 "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2\\cores\\esp8266" "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2\\variants\\nodemcu" "-IG:\\Arduino\\libraries\\ESP8266_Microgear" "-IG:\\Arduino\\libraries\\ESP8266WiFi\\src" "-IG:\\Arduino\\libraries\\EEPROM" "C:\\Users\\LENOVO\\AppData\\Local\\Temp\\arduino_build_259764\\sketch\\20190824NodeMCU_LED_NetPie_LINE_2018009OK.ino.cpp" -o nul

Alternatives for Wire.h: [Wire@1.0]

ResolveLibrary(Wire.h)

  -> candidates: [Wire@1.0]

"C:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\3.0.4-gcc10.3-1757bed/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -D_GNU_SOURCE "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/include" "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/lwip2/include" "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\\Users\\LENOVO\\AppData\\Local\\Temp\\arduino_build_259764/core" -c -w -Werror=return-type -Os -g -free -fipa-pta -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++17 -ffunction-sections -fdata-sections -fno-exceptions -DMMU_IRAM_SIZE=0x8000 -DMMU_ICACHE_SIZE=0x8000 -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10815 -DARDUINO_ESP8266_NODEMCU_ESP12E -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_NODEMCU_ESP12E\"" -DLED_BUILTIN=2 -DFLASHMODE_DIO -DESP8266 "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2\\cores\\esp8266" "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2\\variants\\nodemcu" "-IG:\\Arduino\\libraries\\ESP8266_Microgear" "-IG:\\Arduino\\libraries\\ESP8266WiFi\\src" "-IG:\\Arduino\\libraries\\EEPROM" "-IG:\\Arduino\\libraries\\Wire" "C:\\Users\\LENOVO\\AppData\\Local\\Temp\\arduino_build_259764\\sketch\\20190824NodeMCU_LED_NetPie_LINE_2018009OK.ino.cpp" -o nul

Alternatives for WiFiManager.h: [WiFiManager@0.11]

ResolveLibrary(WiFiManager.h)

  -> candidates: [WiFiManager@0.11]

"C:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\3.0.4-gcc10.3-1757bed/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -D_GNU_SOURCE "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/include" "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/lwip2/include" "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\\Users\\LENOVO\\AppData\\Local\\Temp\\arduino_build_259764/core" -c -w -Werror=return-type -Os -g -free -fipa-pta -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++17 -ffunction-sections -fdata-sections -fno-exceptions -DMMU_IRAM_SIZE=0x8000 -DMMU_ICACHE_SIZE=0x8000 -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10815 -DARDUINO_ESP8266_NODEMCU_ESP12E -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_NODEMCU_ESP12E\"" -DLED_BUILTIN=2 -DFLASHMODE_DIO -DESP8266 "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2\\cores\\esp8266" "-IC:\\Users\\LENOVO\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2\\variants\\nodemcu" "-IG:\\Arduino\\libraries\\ESP8266_Microgear" "-IG:\\Arduino\\libraries\\ESP8266WiFi\\src" "-IG:\\Arduino\\libraries\\EEPROM" "-IG:\\Arduino\\libraries\\Wire" "-IG:\\Arduino\\libraries\\WiFiManager" "C:\\Users\\LENOVO\\AppData\\Local\\Temp\\arduino_build_259764\\sketch\\20190824NodeMCU_LED_NetPie_LINE_2018009OK.ino.cpp" -o nul

Alternatives for ESP8266WebServer.h: []

ResolveLibrary(ESP8266WebServer.h)

  -> candidates: []In file included from G:\workspace\Arduino Project\20190824NodeMCU_LED_NetPie_LINE_2018009OK\20190824NodeMCU_LED_NetPie_LINE_2018009OK.ino:9:



G:\Arduino\libraries\WiFiManager/WiFiManager.h:17:10: fatal error: ESP8266WebServer.h: No such file or directory

   17 | #include <ESP8266WebServer.h>

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

compilation terminated.

Using library ESP8266_Microgear at version 1.2.4 in folder: G:\Arduino\libraries\ESP8266_Microgear 

Using library ESP8266WiFi at version 1.0 in folder: G:\Arduino\libraries\ESP8266WiFi 

Using library EEPROM in folder: G:\Arduino\libraries\EEPROM (legacy)

Using library Wire at version 1.0 in folder: G:\Arduino\libraries\Wire 

Using library WiFiManager at version 0.11 in folder: G:\Arduino\libraries\WiFiManager 

exit status 1

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

ถ้าทุกอย่างถูกต้องแล้ว
ก็คงเหลือแต่เวอร์ชั่น esp8266 ตอนนี้ @PATpatPAT ใช้เวอร์ชั่น 3.0.2 อยู่
ลองลดเวอร์ชั่น ของ Board manager ESP8266 ลง โดยเริ่มต้นที่เวอร์ชั่น 2.7.4 (ลงมา) ครับ แต่ถ้าเป็น 3.0.0 ขึ้นไป บางที Library อาจจะยังไม่รองรับ

1 Likes

Run ได้แล้วครับผม ผมลด version มาเป็น 2.5.2 ครับผม ขอบคุณมากขจริง ๆ ครับ

1 Likes

ยินดีด้วยครับ มากสุดก็ Ver 2.74 ครับ