Close

Freescale KL25z Freedom Board

A project log for PWM examples with multiple architectures

This is the cheat sheet for the Embedded Hardware Workshop

mike-szczysMike Szczys 11/04/2014 at 22:100 Comments

I used the mbed platform to program PWM on this chip. Links to setup your board for mbed and the mbed pwm api are located here: http://hackaday.io/event/3178/log/10740

You need to use the pins that have PwmOut capability shown in this image:

#include "mbed.h"
 
PwmOut servo(PTD4);
 
int main() {
    servo.period_ms(20);
    servo.pulsewidth_ms(2);
    while(1) {
        wait(2);
        servo.pulsewidth_ms(1);
        wait(2);
        servo.pulsewidth_ms(2);
    }
}

Discussions