Bryce Himebaugh / Mbed OS newblinker

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Files at this revision

API Documentation at this revision

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);
+       // }
+          
     }
 }