My Pwm program with method number 1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
neutron_striker
Date:
Sun Feb 15 19:32:08 2015 +0000
Commit message:
My Pwm program with method number 1

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Feb 15 19:32:08 2015 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+
+PwmOut mypwm(LED1);
+
+//DigitalOut myled(LED1);
+
+int main() {
+    
+    mypwm.period_ms(10);
+    mypwm.pulsewidth_ms(1);
+  
+    printf("pwm set to %.2f %%\n", mypwm.read() * 100);
+    
+    while(1) {
+        for(uint8_t i=0;i<10;i++)
+        {
+            mypwm.pulsewidth_ms(i);
+            wait(0.03);   
+        }
+  //      myled = !myled;
+      //  wait(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Feb 15 19:32:08 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa
\ No newline at end of file