Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
gcarmonar
Date:
Wed Oct 09 21:29:12 2013 +0000
Commit message:
Ver1.0

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	Wed Oct 09 21:29:12 2013 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+
+DigitalOut led1(D2);
+DigitalOut led2(D3);
+DigitalOut led3(D4);
+DigitalOut led4(D5);
+AnalogIn pot(A0);
+
+float potval;
+
+int main() {
+    while(1) {
+        potval = pot;
+        if (potval <= 0.2){
+            led1 = 0;
+            led2 = 0;
+            led3 = 0;
+            led4 = 0;
+        }else if (potval <= 0.4){
+            led1 = 1;
+            led2 = 0;
+            led3 = 0;
+            led4 = 0;
+        }else if (potval <= 0.6){
+            led1 = 1;
+            led2 = 1;
+            led3 = 0;
+            led4 = 0;
+        }else if (potval <= 0.8){
+            led1 = 1;
+            led2 = 1;
+            led3 = 1;
+            led4 = 0;
+        }else{
+            led1 = 1;
+            led2 = 1;
+            led3 = 1;
+            led4 = 1;
+        }
+        
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 09 21:29:12 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file