Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of Button by
Revision 0:cf7f8e884a7e, committed 2017-08-12
- Comitter:
- rossatmsoe
- Date:
- Sat Aug 12 20:05:45 2017 +0000
- Commit message:
- Initial version of Button program for MSOE EE2905.
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 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Aug 12 20:05:45 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/fd96258d940d \ No newline at end of file
