Error compiling for board LOLIN(WEMOS) D1 mini Pro

Hi,
I am testing the ESP8266 built-in MEGA2560 and got ERROR need help please.
Thanks
Adam

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
     
const char* ssid = "haha";
const char* password = "cumakamu";

ESP8266WebServer server(80);
MDNSResponder mdns;
     
String webPage = "";
     
int led_pin = 13;
     
void setup(void){
     
  // подготовка:
  pinMode(led_pin, OUTPUT);
  digitalWrite(led_pin, LOW);
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  
  // информация о контроллере
  Serial.println("");
  Serial.println("ESP8266 board info:");
  Serial.print("\tChip ID: ");
  Serial.println(ESP.getFlashChipId());
  Serial.print("\tCore Version: ");
  Serial.println(ESP.getCoreVersion());
  Serial.print("\tChip Real Size: ");
  Serial.println(ESP.getFlashChipRealSize());
  Serial.print("\tChip Flash Size: ");
  Serial.println(ESP.getFlashChipSize());
  Serial.print("\tChip Flash Speed: ");
  Serial.println(ESP.getFlashChipSpeed());
  Serial.print("\tChip Speed: ");
  Serial.println(ESP.getCpuFreqMHz());
  Serial.print("\tChip Mode: ");
  Serial.println(ESP.getFlashChipMode());
  Serial.print("\tSketch Size: ");
  Serial.println(ESP.getSketchSize());
  Serial.print("\tSketch Free Space: ");
  Serial.println(ESP.getFreeSketchSpace());

  // тело веб-страницы
  webPage += "<h1>ESP8266 Web Server</h1>";
  webPage += "<p>Chip ID: ";
  webPage += ESP.getFlashChipId();
  webPage += "</p>";
  webPage += "<p>Core Version: ";
  webPage += ESP.getCoreVersion();
  webPage += "</p>";
  webPage += "<p>Chip Real Size: ";
  webPage += ESP.getFlashChipRealSize()/1024;
  webPage += " Kbit</p>";
  webPage += "<p>Chip Size: ";
  webPage += ESP.getFlashChipSize()/1024;
  webPage += " Kbit</p>";
  webPage += "<p>Chip Flash Speed: ";
  webPage += ESP.getFlashChipSpeed()/1000000;
  webPage += " MHz</p>";
  webPage += "<p>Chip Work Speed: ";
  webPage += ESP.getCpuFreqMHz();
  webPage += " MHz</p>";
  webPage += "<p>Chip Mode: ";
  webPage += ESP.getFlashChipMode();
  webPage += "</p>";
  webPage += "<p>LED state <a href=\"LedON\"><button>ON</button></a>&nbsp;<a href=\"LedOFF\"><button>OFF</button></a></p>";

  // подключение к WiFi
  WiFi.begin(ssid, password);
  Serial.println("");
     
  // ожидание соединения:
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");  //  
  Serial.println(ssid);
  Serial.print("IP address: ");  //  
  Serial.println(WiFi.localIP());

  //  Проверка запуска MDNS
  if (mdns.begin("esp8266", WiFi.localIP())) {
    Serial.println("MDNS responder started");
  }
     
  server.on("/", [](){
    server.send(200, "text/html", webPage);
  });
  
  server.on("/LedON", [](){
    server.send(200, "text/html", webPage);
    digitalWrite(led_pin, HIGH);
    Serial.println("[ON]");
    delay(1000);
  });
  
  server.on("/LedOFF", [](){
    server.send(200, "text/html", webPage);
    digitalWrite(led_pin, LOW);
    Serial.println("[OFF]");
    delay(1000);
  });
  
  server.begin();
  Serial.println("HTTP server started");
  
}
     
void loop(void){
  server.handleClient();
}

ERROR:

Arduino: 1.8.16 (Windows 7), Board: "LOLIN(WEMOS) D1 mini Pro, 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, 16MB (FS:14MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 921600"

In file included from C:\Users\HUA.DELLV-PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266mDNS\src/LEAmDNS.h:109,

                 from C:\Users\HUA.DELLV-PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266mDNS\src/ESP8266mDNS.h:48,

                 from E:\ENGINEERING\DIY\Electronic\ARDUINO\mega2560_wifi\Arduino Mega Wifi\Program_blynk_ESP_Test\Program_blynk_ESP_Test.ino:4:

C:\Users\HUA.DELLV-PC\Documents\Arduino\libraries\ESP8266WiFi\src/include/UdpContext.h: In member function 'bool UdpContext::sendTimeout(const ip_addr_t*, uint16_t, esp8266::polledTimeout::timeoutTemplate<false, esp8266::polledTimeout::YieldPolicy::DoNothing, esp8266::polledTimeout::TimePolicy::TimeUnit<esp8266::polledTimeout::TimePolicy::TimeSourceCycles, 1000> >::timeType)':

C:\Users\HUA.DELLV-PC\Documents\Arduino\libraries\ESP8266WiFi\src/include/UdpContext.h:414:13: error: 'esp_yield' was not declared in this scope

  414 |             esp_yield();

      |             ^~~~~~~~~

exit status 1

Error compiling for board LOLIN(WEMOS) D1 mini Pro.



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

if I compile the program using the Arduino IDE V1.8.13 board selected LOLIN(WEMOS) D1 mini Pro
it compiles OK
I think esp_yeild() is declared in Arduino.h which should be included automatically

1 Like

I had the same experience in that I could compile for a wemos D1 8266.

C:\Users\HUA.DELLV-PC\Documents\Arduino\libraries\ESP8266WiFi

This looks wrong. The code should use the library packed with the esp8266 core.

You should see

Using library ESP8266WiFi at version 1.0 in folder: C:\Users\user name\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi

Maybe because of the dual Mega and ESP board and the different modes of use, there is a library in the wrong place.

I would remove the esp8266 wifi library from the Arduino folder and thereby force the use of the esp8266 wifi library from its core.

2 Likes

Great!
Thanks.

Thanks.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.