Analog to 7 Segment (0-3.3 Volt Meter)

Dependencies:   mbed

Revision:
0:35597540ea31
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 13 07:36:32 2015 +0000
@@ -0,0 +1,22 @@
+#include "mbed.h"
+Serial pc(USBTX, USBRX); // tx, rx
+
+AnalogIn ain(PC_0);
+BusOut dout(D6,D7,D8);
+BusOut dout2(D9,D10,D11,D12,D13);
+
+int main(){
+    int value; //First Digit Value
+    int dvalue; //Second Digit Value
+    float data; //Raw Data (store AnalogRead)
+    while(1){
+        data = ain.read(); // Data 0.0 -> 1.0
+        value = data * 3.3; // Data 0.0 -> 3.3 (Int 0 - > 3)
+        dout = value; //Bus out 0 - 3
+        
+        dvalue = data*33; // Data 00 -> 33
+        dvalue = dvalue %10; // Data 0 - 9
+        dout2 = dvalue; //Bus out number 0 - 9
+    
+    }
+}
\ No newline at end of file