Analog to 7 Segment (0-3.3 Volt Meter)
Dependencies: mbed
Revision 0:35597540ea31, committed 2015-10-13
- Comitter:
- mustwillza
- Date:
- Tue Oct 13 07:36:32 2015 +0000
- Commit message:
- Data
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 35597540ea31 main.cpp --- /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
diff -r 000000000000 -r 35597540ea31 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 13 07:36:32 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7e07b6fb45cf \ No newline at end of file