FRDM-K64 PWM basic example using mbed

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

FRDM-K64 PWM basic example using mbed

FRDM-K64 PWM basic example using mbed

Here you can find both the code and project files for the PWM project, in this example a single PWM channel belonging to the Flextimer 0 (PTC10/FTM_CH12) is enabled to provide a PWM signal with a 500ms period, the signal's duty cycle increases its period every 100ms, to visually observe the signal connect a led from the A5 pin in the J4 connector to GND (J3, pin 14).

Code:

#include "mbed.h"

//PWM output channel

PwmOut PWM1(A5);

int main()

{

    PWM1.period_ms(500);

    int x;

    x=1;

   

    while(1)

    {

        PWM1.pulsewidth_ms(x);

        x=x+1;

        wait(.1);

        if(x==500)

        {

            x=1;

        }

    }

}

添付
評価なし
バージョン履歴
最終更新日:
‎06-27-2014 11:04 AM
更新者: