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.
Fork of mbed-os-example-mbed5-blinky by
Revision 57:a3c0babfccea, committed 2018-01-23
- Comitter:
- bhimebau
- Date:
- Tue Jan 23 20:23:54 2018 +0000
- Parent:
- 56:939270a94e87
- Child:
- 58:f1306dbfb574
- Commit message:
- Program to push buttons;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Jan 10 23:38:29 2018 +0000
+++ b/main.cpp Tue Jan 23 20:23:54 2018 +0000
@@ -1,12 +1,25 @@
#include "mbed.h"
DigitalOut led1(LED1);
+Serial pc(USBTX, USBRX);
+DigitalIn button(PC_13);
// main() runs in its own thread in the OS
int main() {
while (true) {
- led1 = !led1;
- wait(.1);
+ if (button.read()) led1 = 1;
+ else led1=0;
+ //pc.putc(pc.getc());
+ //led1 = !led1;
+ //if (led1) {
+ // pc.printf("ON\n\r");
+ // wait(2);
+ // }
+ // else {
+ // pc.printf("OFF\n\r");
+ // wait(1);
+ // }
+
}
}
