eiei

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Peeraya
Date:
Wed Oct 14 04:44:25 2015 +0000
Commit message:
VR

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 14 04:44:25 2015 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+
+AnalogIn analog_value(A1);
+
+DigitalOut myled1(D13);
+DigitalOut myled2(D12);
+DigitalOut myled3(D11);
+DigitalOut myled4(D10);
+DigitalOut myled5(D9);
+DigitalOut myled6(D8);
+DigitalOut myled7(D7);
+DigitalOut myled8(D4);
+
+
+int main() {
+    float meas;
+    
+    while(1) {
+        meas = analog_value.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
+        if(meas<0.0625){myled1=0;myled2=0;myled3=0;myled4=0;myled5=0;myled6=0;myled7=0;myled8=0;}
+        else if(meas<0.1875){myled1=1;myled2=0;myled3=0;myled4=0;myled5=0;myled6=0;myled7=0;myled8=0;}
+        else if(meas<0.3125){myled1=1;myled2=1;myled3=0;myled4=0;myled5=0;myled6=0;myled7=0;myled8=0;}
+        else if(meas<0.4375){myled1=1;myled2=1;myled3=1;myled4=0;myled5=0;myled6=0;myled7=0;myled8=0;}
+        else if(meas<0.5625){myled1=1;myled2=1;myled3=1;myled4=1;myled5=0;myled6=0;myled7=0;myled8=0;}
+        else if(meas<0.6875){myled1=1;myled2=1;myled3=1;myled4=1;myled5=1;myled6=0;myled7=0;myled8=0;}
+        else if(meas<0.8125){myled1=1;myled2=1;myled3=1;myled4=1;myled5=1;myled6=1;myled7=0;myled8=0;}
+        else if(meas<0.9375){myled1=1;myled2=1;myled3=1;myled4=1;myled5=1;myled6=1;myled7=1;myled8=0;}
+        else{myled1=1;myled2=1;myled3=1;myled4=1;myled5=1;myled6=1;myled7=1;myled8=1;}
+        
+    }
+}
+            
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 14 04:44:25 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68
\ No newline at end of file