Augusto Panecatl / Mbed 2 deprecated FRDM-K64_PWM

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 //PWM output channel
00004 PwmOut PWM1(A5);
00005 
00006 int main() 
00007 {
00008     PWM1.period_ms(500);
00009     int x;
00010     x=1;
00011     
00012     while(1)
00013     {
00014         PWM1.pulsewidth_ms(x);
00015         x=x+1;
00016         wait(.1);
00017         if(x==500)
00018         {
00019             x=1;
00020         }
00021     }
00022 }