Ralph Fulchiero
/
OS2_PwmOut_HelloWorld
OS2 version of the classic PwmOut
Revision 0:94058fd41b33, committed 2018-09-11
- Comitter:
- RalphF
- Date:
- Tue Sep 11 15:39:08 2018 +0000
- Commit message:
- This is an OS2 version of the PwmOut handbook example: ; https://os.mbed.com/handbook/PwmOut; The published version was bumped to OS5.;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 94058fd41b33 main.cpp --- /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
diff -r 000000000000 -r 94058fd41b33 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Sep 11 15:39:08 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file