Ralph Fulchiero
/
OS2_PwmOut_HelloWorld
OS2 version of the classic PwmOut
Diff: main.cpp
- Revision:
- 0:94058fd41b33
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Sep 11 15:39:08 2018 +0000 @@ -0,0 +1,12 @@ +#include "mbed.h" + +PwmOut led(LED1); + +int main() { + // specify period first + led.period(4.0f); // 4 second period + led.write(0.50f); // 50% duty cycle, relative to period + //led = 0.5f; // shorthand for led.write() + //led.pulsewidth(2); // alternative to led.write, set duty cycle time in seconds + while(1); +} \ No newline at end of file