Polling EXAMPLE

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
sivaieee
Date:
Mon Nov 14 20:43:29 2016 +0000
Commit message:
Turning on LED through a switch

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
diff -r 000000000000 -r 2b7a68f02b66 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Nov 14 20:43:29 2016 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+
+DigitalOut myled(LED1);
+DigitalOut vrefh(D8);
+DigitalIn mySw(D15);
+Serial pc(USBTX, USBRX);
+
+int main() {
+    vrefh = 0;
+    while(1) {
+     
+        if (mySw == 0)
+        {
+        myled = 1;
+        pc.printf("MY SW IS HIGH\n");
+        }
+        if (mySw == 1)
+        {
+        myled = 0;
+        pc.printf("MY SW IS LOW\n");
+        }
+    }
+}
diff -r 000000000000 -r 2b7a68f02b66 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Nov 14 20:43:29 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/0ab6a29f35bf
\ No newline at end of file