d

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
cha45689
Date:
Mon Oct 31 14:48:31 2016 +0000
Commit message:
ddd

Changed in this revision

Lab2_2.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/Lab2_2.cpp	Mon Oct 31 14:48:31 2016 +0000
@@ -0,0 +1,22 @@
+
+#include "mbed.h"
+ 
+AnalogIn analog_value(A2);
+DigitalOut i(D10);
+BusOut leds(D2, D3, D4, D5);
+BusOut leds1(D6, D7, D8, D9);
+int main() {
+    while(1) {
+        double meas = analog_value.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
+        printf ("\n%f",meas);
+        meas = meas * 33; // Change the value to be in the 0 to 3300 range
+        int b=meas;
+        int c = b % 10;
+        int d = b % 100 - c;
+        leds=c;
+        leds1=d/10;
+        i=1;
+        
+    }
+}
+// When the board read data on analog value to over 3.3 v., There will be error
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Oct 31 14:48:31 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3
\ No newline at end of file