New at Platformio and teensy 4.0. Servo.h error

Status
Not open for further replies.

scanf30

New member
I'm trying to control a drone motor with teensy 4.0. This is my code:

#include <Servo.h>
#define pin_esc 23
Servo esc;


void setup() {
esc.attach(pin_esc);
esc.writeMicroseconds(1000);
delay(1000);

}

void loop() {
int val = analogRead(A0);
//val = map(val, 0, 1023, 1000, 2000);
esc.writeMicroseconds(1500);
delay(15);
}

In teensyduino 1.8.13 works well, but when I trying in Platformio i get this error:
"This library only supports boards with an AVR, SAM or SAMD processor."

I looked for the servo lib in teensyduino but I didn't find it.
 
On my machine with PlatformIO, the teensy specific Servo library is located at ~/.platformio/packages/framework-arduinoteensy/libraries/Servo/Servo.h
 
On my machine with PlatformIO, the teensy specific Servo library is located at ~/.platformio/packages/framework-arduinoteensy/libraries/Servo/Servo.h

It sounds like PlatformIO is using an old version of the Servo library. I don't use PlatformIO so you may what to report it to them.

You might try downloading the latest and greatest Servo library from PJRC and replacing the Servo files at that location. Don't know if it would break anything else though.
 
It sounds like PlatformIO is using an old version of the Servo library. I don't use PlatformIO so you may what to report it to them.

You might try downloading the latest and greatest Servo library from PJRC and replacing the Servo files at that location. Don't know if it would break anything else though.
The files at that location are identical to the files at the link that Paul posted.

The only place that contains the string
Code:
"This library only supports boards with an AVR, SAM or SAMD processor."
is the arduino specific header. On my machine this is installed at /usr/share/arduino/libraries/Servo/src/Servo.h.

Somehow PlatformIO is picking up the wrong version during build...
 
The files at that location are identical to the files at the link that Paul posted.

Well using the Arduino IDE I just compiled your sketch with no errors or warnings.

Capture.PNG

I am assuming you have to select Teensy 4 in platformIO so only other thing is are you sure you are compiling for Teensy 4. Other than that, sounds like its a platformIO issue which I can't help you with - dont know anything about platformIO.
 
I am assuming you have to select Teensy 4 in platformIO so only other thing is are you sure you are compiling for Teensy 4. Other than that, sounds like its a platformIO issue which I can't help you with - dont know anything about platformIO.
Either the OP has not installed the teensy framework, or the board = directive in platformio.ini is missing or wrong
 
I had the same problem as OP, but it was solved with replacing the servo library in platformio with the library from PaulStoffregen.
My library was located at C:\Users\usr\.platformio\lib\Servo
 
Status
Not open for further replies.
Back
Top