Hello, can you please help with my topic?
I am new in platformio and I want to learn esp32 (I had already some experiences with Arduino). In PlatformIO IDE I have always problem with header file. I checked also official documentation and reinstall VSC but my problem still exists. Below the output after build. May please advice me what can help. Thank you Gabriel
Processing esp32doit-devkit-v1 (platform: espressif32; board: esp32doit-devkit-v1; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32doit-devkit-v1.html
PLATFORM: Espressif 32 (3.1.1) > DOIT ESP32 DEVKIT V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
* framework-arduinoespressif32 3.10005.210308 (1.0.5)
* tool-esptoolpy 1.30000.201119 (3.0.0)
* toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder → http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 32 compatible libraries
Scanning dependencies…
Dependency Graph
|-- 1.1.7
Building in release mode
Compiling .pio\build\esp32doit-devkit-v1\src\main.c.o
Generating partitions .pio\build\esp32doit-devkit-v1\partitions.bin
In file included from src\main.c:1:0:
.pio\libdeps\esp32doit-devkit-v1\Servo\src/Servo.h:77:2: error: #error “This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor.”
#error “This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor.”
^
.pio\libdeps\esp32doit-devkit-v1\Servo\src/Servo.h:104:1: error: unknown type name ‘class’
class Servo {
^
.pio\libdeps\esp32doit-devkit-v1\Servo\src/Servo.h:104:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘**attribute**’ before ‘{’ token
class Servo {
^
src\main.c:3:1: error: unknown type name ‘Servo’
Servo myservo; // create servo object to control a servo
^
src\main.c: In function ‘setup’:
src\main.c:9:9: error: request for member ‘attach’ in something not a structure or union
myservo.attach(13); // attaches the servo on pin 13 to the servo object
^
src\main.c: In function ‘loop’:
src\main.c:16:12: error: request for member ‘write’ in something not a structure or union
myservo.write(pos); // tell servo to go to position in variable ‘pos’
^
src\main.c:17:5: warning: implicit declaration of function ‘delay’ [-Wimplicit-function-declaration]
delay(15); // waits 15ms for the servo to reach the position
^
src\main.c:20:12: error: request for member ‘write’ in something not a structure or union
myservo.write(pos); // tell servo to go to position in variable ‘pos’
^
Compiling .pio\build\esp32doit-devkit-v1\libfed\Servo\avr\Servo.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\libfed\Servo\mbed\Servo.cpp.o
*** [.pio\build\esp32doit-devkit-v1\src\main.c.o] Error 1
================================================================ [FAILED] Took 2.86 seconds ================================================================The terminal process “C:.platformio\penv\Scripts\platformio.exe ‘run’” terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
So you should first use the “Clean” project task, then remove the .pio folder of the project to fully get rid of the old library, and then use the new library per
Hello Max, as you recommended to me I used the new library ESP32Servo. I did the initialization of the new project according to instructions written in doc.platformio(Quick Start). Even though after compilation I still received error and compilation was terminated.
May please let me know what should I do that it works?
Thank you
my project structure:
Here is the description of the failure.
PS C:\esp32\servo> pio run --target upload
Processing esp32doit-devkit-v1 (platform: espressif32; board: esp32doit-devkit-v1; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32doit-devkit-v1.html
PLATFORM: Espressif 32 (3.1.1) > DOIT ESP32 DEVKIT V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 3.10005.210308 (1.0.5)
- tool-esptoolpy 1.30000.201119 (3.0.0)
- tool-mkspiffs 2.230.0 (2.30)
- toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 32 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESP32Servo> 0.9.0
Building in release mode
Compiling .pio\build\esp32doit-devkit-v1\src\main.c.o
Generating partitions .pio\build\esp32doit-devkit-v1\partitions.bin
src\main.c:1:25: fatal error: ESP32_Servo.h: No such file or directory
*********************************************************************
* Looking for ESP32_Servo.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:ESP32_Servo.h"
* Web > https://platformio.org/lib/search?query=header:ESP32_Servo.h
*
*********************************************************************
compilation terminated.
Compiling .pio\build\esp32doit-devkit-v1\lib880\ESP32Servo\ESP32PWM.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\lib880\ESP32Servo\ESP32Servo.cpp.o
*** [.pio\build\esp32doit-devkit-v1\src\main.c.o] Error 1
=============================================== [FAILED] Took 5.38 seconds =
Ok, thank you it works now. Additionally I was also pressing the BOOT button on my ESP32 board during compiling. Without this it could not work. Thank you for your help. Gabriel