1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
miguelmstein
Date:
Thu Apr 06 00:39:19 2017 +0000
Commit message:
new

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 78b238cef288 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Apr 06 00:39:19 2017 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+
+DigitalOut  my_led(LED1);
+InterruptIn my_button(USER_BUTTON);
+PwmOut      my_pwm(PB_3);
+
+void pressed() {
+    if (my_pwm.read() == 0.25) {
+        my_pwm.write(0.75);
+    }
+    else {
+        my_pwm.write(0.25);
+    }
+}
+
+int main()
+{
+    // Set PWM
+    my_pwm.period_ms(10);
+    my_pwm.write(0.2);
+    
+    // Set button
+    my_button.fall(&pressed);
+    
+    while (1) {
+        my_led = !my_led;
+        wait(0.2); // 500 ms
+    }
+}
diff -r 000000000000 -r 78b238cef288 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Apr 06 00:39:19 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/856d2700e60b
\ No newline at end of file