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.
#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?
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.
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:
You only need to add an #include directive for mbed.h.
Have you done that @jerteach? If so, please post the full error output. If you haven't done it, and want more detailed instructions, I'm happy to provide them.
Pert, that was the issue. Until the library is updated you only have to change that one line of code. Strangely hard on windows because the directory was locked. Had to load notepad in administrator mode. The file was at