ADC & DAC Analog
Dependencies: mbed
Revision 0:6e57665bf436, committed 2015-10-15
- Comitter:
- madmonkeyman82
- Date:
- Thu Oct 15 16:02:34 2015 +0000
- Commit message:
- ADC & DAC Analog
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 6e57665bf436 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Oct 15 16:02:34 2015 +0000 @@ -0,0 +1,33 @@ +#include "mbed.h" + + +DigitalOut Vcc(PA_0); +AnalogIn aInn(PA_1); +DigitalOut Gnd(PA_4); + + +int main() +{ + Vcc = 1; + Gnd = 0; + + float maxVoltage,minVoltage,voltage; + + maxVoltage = aInn.read()*3.3f; + minVoltage = aInn.read()*3.3f; + + while(1) + { + voltage = aInn.read()*3.3f; + + if(voltage < minVoltage) minVoltage = voltage; + if(voltage > maxVoltage) maxVoltage = voltage; + + printf("VoltIn: %.3f Max: %.3f Min: %.3f Diff: %.3f\r\n", voltage, maxVoltage, minVoltage, maxVoltage-minVoltage); + + // printf("Voltage:\t%.3f \r\n", voltage); + wait_ms(135); + } + + +}
diff -r 000000000000 -r 6e57665bf436 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Oct 15 16:02:34 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file