PWMの動作確認

Dependencies:   mbed-dev

Fork of PwmOut_HelloWorld by Mbed

Files at this revision

API Documentation at this revision

Comitter:
nameless129
Date:
Sat May 14 16:09:54 2016 +0000
Parent:
1:5160ea45399b
Commit message:
first commit

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-dev.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show diff for this revision Revisions of this file
diff -r 5160ea45399b -r 299eced0517c main.cpp
--- a/main.cpp	Sun Sep 21 06:39:30 2014 +0000
+++ b/main.cpp	Sat May 14 16:09:54 2016 +0000
@@ -1,12 +1,14 @@
 #include "mbed.h"
 
-PwmOut led(LED1);
+PwmOut led(P0_8);
 
 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);
+    led.period_us(26);      // 4 second period
+    led.write(0);      // 50% duty cycle, relative to period
+    while(1) {
+        led.write(0);
+        wait(1);
+        led.write(0.1);
+        wait(1);
+    }    
 }
\ No newline at end of file
diff -r 5160ea45399b -r 299eced0517c mbed-dev.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-dev.lib	Sat May 14 16:09:54 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mbed_official/code/mbed-dev/#c31e94a47539
diff -r 5160ea45399b -r 299eced0517c mbed.bld
--- a/mbed.bld	Sun Sep 21 06:39:30 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file