MSOE EE2905 / Mbed 2 deprecated Button

Dependencies:   mbed

Fork of Button by Sheila Ross

Revision:
0:cf7f8e884a7e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Aug 12 20:05:45 2017 +0000
@@ -0,0 +1,26 @@
+/* Button
+
+Reads the USER_BUTTON and flashes LED if pressed.
+
+based on built-in mbed example Nucleo_read_button
+modified 12 Aug 2017 by Sheila Ross
+
+*/
+
+#include "mbed.h"
+ 
+// Declare USER_BUTTON to be a digital input
+DigitalIn mybutton(USER_BUTTON);
+
+// Declare LED1 to be a digital output
+DigitalOut myled(LED1);
+ 
+int main() {
+  while(1) {
+    if (mybutton == 0) { // Button is pressed
+      myled = !myled; // toggle LED on/off
+      wait(0.2);
+    }
+  }
+}
+ 
\ No newline at end of file