How to use the newest version of espressif/arduino-esp32?

I am trying to create an ESP32 I2C Slave device. The problem is that the ESP32 did not support Wire.onReceive() functionality until recently (October 14th), according to the pull request

The pull request tells me that I2C Slave functionality has been implemented into the ESP32 Arduino core. However when I try to use the Wire.onReceive() I get the following errors:

.pio\build\esp32dev\src\main.cpp.o:(.literal._Z5setupv+0x1c): undefined reference to TwoWire::onReceive(void (*)(int))'* *.pio\build\esp32dev\src\main.cpp.o: In function setup()':
D:\Libraries\Documents\PlatformIO\Projects\I2CSlave/src/main.cpp:26: undefined reference to `TwoWire::onReceive(void ()(int))'*
collect2.exe: error: ld returned 1 exit status
**** [.pio\build\esp32dev\firmware.elf] Error 1*

This tells me that it does not work within PlatformIO (vscode). Now I already updated PlatformIO and all platforms, packages and libraries. But still to no avail.

Does anyone know how I can get the latest version of arduino-esp32 on Platform IO?

There are lots of threads about this topic – PlatformIO uses Arduino-ESP32 1.0.6 and 2.0.x support is currently an open issue.

As explained in Which C++ standard am I using? - #4 by maxgerhardt, one can currently use the platformio.ini

[env:esp32dev]
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-idf-master
board = esp32dev
framework = arduino
platform_packages =
   framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.1

to get a preview of 2.0.1.

2 Likes

Thanks, it compiles! I was not aware that PlatformIO was still on 1.0.6.