Espnow.h not found for D1 Mini

Dear community,
I am freshly moved from Arduino to PlaformIO and see a lot of helpfull functions waiting for me :slight_smile:
I tried to complile some sketches which runs under Arduino so far - with my Wemos D1 Mini he didnt find the ESPNow libraries:

thats my platformio.ini:
[env:wemos_d1_mini32]
platform = espressif32
board = wemos_d1_mini32
framework = arduino

lib_deps =
BlueDot_BME28

And thats the declaration in the source code:

#include <Arduino.h>
#include <WiFi.h>
extern “C”
{
#include <espnow.h>
}
#include “BlueDot_BME280.h”

I am running PlatformIO on VSCode on MacOS.

Any help is appreciated !

Br Peter

According to the source code

https://github.com/espressif/arduino-esp32/blob/master/tools/sdk/include/esp32/esp_now.h

This file is called esp_now.h and not espnow.h? Are you sure the exact same sketch compiles under Arduino IDE?

Hi Maxgerhardt,

looks interesting. Yes, it does:

When I try that with esp_now.h I get an error in Arduino:

ESPNOW_AS_MQTT_Collector_V4:16:23: fatal error: esp_now.h: No such file or directory
#include <esp_now.h>
^
compilation terminated.
exit status 1
esp_now.h: No such file or directory

Thanks for your support !

Br Peter

Eh, yikes, I referenced the ESP32 Arduino core and not the ESP8266 core. It’s indeed called espnow.h there.

I’ll check if the include flags are correct.

No wait a second. You’re compiling an ESP8266 sketch for a target NodeMCU board in the Arduino IDE.

But in your platformio.ini you want to programm a Wemos D1 Mini32, which has an ESP32 chip.

Which exact target board do you physically have? It might just that you meant to just select the D1 Mini (ESP8266) and not the D1 Mini32 (ESP32).

If that’s the case, use the following platformio.ini

[env:d1_mini]
platform = espressif8266
board = d1_mini
framework = arduino
1 Like

I have both boards - the D1 Mini Lite (Sensor Node) and the Nodemcu (Data Collector). But you are right, I will check if I not mixed up details in the platformio.ini. Will come back with the result.
Thanks a lot for the hint !
Br Peter

Then you shouldn’t choose a D1 Mini as the PlatformIO target, but the D1 Mini Lite. These have different flash sizes so the firmware might not work interchangebly.

See WeMos D1 mini Lite — PlatformIO latest documentation

(i.e., just put board = d1_mini_lite)

2 Likes

I will do so and come back with results.

Thanks once more for your support !
Br Peter

1 Like