
ad test
Revision 3:c8e6635e6f4b, committed 2016-10-28
- Comitter:
- pedro_C
- Date:
- Fri Oct 28 13:37:10 2016 +0000
- Parent:
- 2:6d058686efbf
- Commit message:
- test
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 6d058686efbf -r c8e6635e6f4b main.cpp --- a/main.cpp Thu Mar 12 08:22:00 2015 +0000 +++ b/main.cpp Fri Oct 28 13:37:10 2016 +0000 @@ -1,24 +1,66 @@ #include "mbed.h" - -AnalogIn analog_value(A0); - -DigitalOut led(LED1); -int main() { +AnalogIn analog_1(PA_3); +AnalogIn analog_2(PC_0); +AnalogIn analog_3(PC_3); +AnalogIn analog_4(PF_3); +AnalogIn analog_5(PF_10); +AnalogIn analog_6(PA_7); +AnalogIn analog_7(PF_8); +AnalogIn analog_8(PF_7); +AnalogIn analog_9(PF_9); + +Serial pc(USBTX,USBRX); + +Timer t; + + +int main() +{ + t.start(); + pc.baud(115200); float meas; - - printf("\nAnalogIn example\n"); - + + // pc.printf("\nAnalogIn example\n"); + while(1) { - meas = analog_value.read(); // Converts and read the analog input value (value from 0.0 to 1.0) + pc.printf("%f seconds\t", t.read()); + meas = analog_1.read(); // Converts and read the analog input value (value from 0.0 to 1.0) + meas = meas * 3300; // Change the value to be in the 0 to 3300 range + pc.printf("%.0f mV, \t", meas); + + meas = analog_2.read(); // Converts and read the analog input value (value from 0.0 to 1.0) + meas = meas * 3300; // Change the value to be in the 0 to 3300 range + pc.printf("%.0f mV, \t", meas); + + meas = analog_3.read(); // Converts and read the analog input value (value from 0.0 to 1.0) + meas = meas * 3300; // Change the value to be in the 0 to 3300 range + pc.printf("%.0f mV, \t", meas); + + meas = analog_4.read(); // Converts and read the analog input value (value from 0.0 to 1.0) meas = meas * 3300; // Change the value to be in the 0 to 3300 range - printf("measure = %.0f mV\n", meas); - if (meas > 2000) { // If the value is greater than 2V then switch the LED on - led = 1; - } - else { - led = 0; - } - wait(0.2); // 200 ms + pc.printf("%.0f mV, \t", meas); + + meas = analog_5.read(); // Converts and read the analog input value (value from 0.0 to 1.0) + meas = meas * 3300; // Change the value to be in the 0 to 3300 range + pc.printf("%.0f mV, \t", meas); + + meas = analog_6.read(); // Converts and read the analog input value (value from 0.0 to 1.0) + meas = meas * 3300; // Change the value to be in the 0 to 3300 range + pc.printf("%.0f mV, \t\t", meas); + + meas = analog_7.read(); // Converts and read the analog input value (value from 0.0 to 1.0) + meas = meas * 3300; // Change the value to be in the 0 to 3300 range + pc.printf("%.0f mV, \t", meas); + + meas = analog_8.read(); // Converts and read the analog input value (value from 0.0 to 1.0) + meas = meas * 3300; // Change the value to be in the 0 to 3300 range + pc.printf("%.0f mV, \t", meas); + + meas = analog_9.read(); // Converts and read the analog input value (value from 0.0 to 1.0) + meas = meas * 3300; // Change the value to be in the 0 to 3300 range + pc.printf("%.0f mV, \n", meas); + + wait_ms(20); } }
diff -r 6d058686efbf -r c8e6635e6f4b mbed.bld --- a/mbed.bld Thu Mar 12 08:22:00 2015 +0000 +++ b/mbed.bld Fri Oct 28 13:37:10 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/7e07b6fb45cf \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3 \ No newline at end of file