Go Down

Topic: Arduino Portenta H7 Servo  (Read 271 times) previous topic - next topic

SpaseRe

 Hello guys,

I recently bought a Protenta h7 to use it as a brain in my "self-driving" quadcopter. I had tried something similar with a Mega board, but was lacking processing power.

The problem is that I can't use the Servo.h library, because it is not yet supported for that board. (I need the Servo library to send the desired pulse to ESCs.)

ESCs get a standard 50Hz PWM pulse.
Code: [Select]

#include <Servo.h>
Servo servo;     // create servo object

void setup() {
    // Attach the ESC on my pin
    servo.attach(A0,1000,2000); // (pin, min pulse width, max pulse width in microseconds)
}
void loop() {
 
    servo.write(1200);    // Send PWM to ESC
}



The above code would set the motor to 20% speed.

Anything to suggest?
If not, any idea whether and when they add it to supported boards?

Thanks!

sbhklr

Hi SpaseRe! Thanks for pointing this out. It's definitely something we want to support asap. Let me investigate the timeframe for this. I'll keep you posted.

sbhklr

Hi SpaseRe!

I had a look at the Servo library and it seems that there was a small bug that prevented the library from compiling for Portenta. I've submitted a fix which we'll merge once reviewed. You can check the PR here:
https://github.com/arduino-libraries/Servo/pull/60

Go Up