I’m not sure why exactly but whenever I try to use some basic libraries from the arduino framework they never are supported. I’m using an bluepill_f103c8 with STM32duino (or atleast I think that what it’s using)
This is my configuration:
I always get an compile error:
.pio\libdeps\bluepill_f103c8\Servo\src/Servo.h:77:2: error: #error "This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor."
Which is weird, because when I copy&paste my code to the Arduino IDE it compiles without any problem for that board. I’m only trying to use the <Servo.h> library.
My current guess is that STM32Duino isn’t really targeted due to a misconfiguration, though in another thread the addition of board_build.core fixed the issue which sadly didn’t help on my end.
Well yeah I tried that out, but it still picks the “wrong” servo library
All servo libraries that are in the registry either don’t work or also show the same compability issue (even if they show compability to my plattform ).
I’m not exactly sure where the Arduino IDE + STM32Duino picks out their servo library but whatever the stm32duino version/implementation in PlattformIO does it’s not compatible at all to all other libraries. (even normal arduino ones that don’t use any hardware specific features.)
#define POT_PIN 0
int val = analogRead(POT_PIN); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
the LDF will pick up the internal library automatically since it sees #include<Servo.h> in the main file.
(verbose build output)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 13 compatible libraries
|-- <Servo> 1.1.2 (C:\Users\Max\.platformio\packages\framework-arduinoststm32\libraries\Servo)
Building in release mode
I’d suggest to reproduce my config and remove the .pio folder of the project completely and rebuild.
I can’t even remember on which project I did that and how many years ago that was.
Yeah I did that in the beginning, I’m always using the per-project settings on current projects to avoid this problem .