A very simple wrapper around the PWM library.

Dependents:   JS_1motor_20170707_ok Task_1_BallRidingbot_KeepingStationCatching_layingDown_1230 Task_2_BallRidingbot_MovingForwardCatching_backward_1230 testSSWMR_StationKeeping_200170830_OK ... more

Homepage

This is my own wrapper around the PWM library. It handles servos with very long pulse intervals much better. It doesn't HAVE to be used with a servo, but I'm not too sure what else you could use it for. In any case, you're welcome to use it for whatever purpose you want.

Example code is shown below:

#include "mbed.h"
#include "Servo.h"

Servo servo(p26);

int main(void) {
	// .calibrate(pulse interval, minimum pulse width, maximum pulse width)
	servo.calibrate(0.02, 0.05*0.02, 0.10*0.02);
	float val = 0.0;
	while(1) {
		servo.write(val);
		val = val < 1.0 ? val + 0.1 : 0;
		wait(1);
	}
}

All wikipages