button (push to on switch) interfacing

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
kumaresh
Date:
Fri Apr 17 12:55:30 2015 +0000
Commit message:
button (push to on switch) interfacing

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	Fri Apr 17 12:55:30 2015 +0000
@@ -0,0 +1,15 @@
+#include "mbed.h"
+ 
+DigitalIn mybutton(USER_BUTTON); // user switch available in ST32 nucleo boards
+DigitalIn sw1(PC_13);           // refer UM1724 ST nucleo User manual for pin details
+DigitalOut myled(LED1);
+ 
+int main() {
+  while(1) {
+    if (sw1 == 0) {                // or you can use mybutton
+      myled = !myled; // Toggle the LED state
+      wait(0.2); // 200 ms
+    }
+  }
+}
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Apr 17 12:55:30 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/433970e64889
\ No newline at end of file