PwmOut Hello World

Fork of PwmOut_HelloWorld by Mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 PwmOut led(LED1);
00004 
00005 int main() {
00006     // specify period first
00007     led.period(4.0f);      // 4 second period
00008     led.write(0.50f);      // 50% duty cycle, relative to period
00009     //led = 0.5f;          // shorthand for led.write()
00010     //led.pulsewidth(2);   // alternative to led.write, set duty cycle time in seconds
00011     while(1);
00012 }