1
Dependencies: mbed
Fork of cz_odleglosci by
Revision 0:ba832b770a32, committed 2015-04-20
- Comitter:
- abm_mechatronika
- Date:
- Mon Apr 20 07:47:05 2015 +0000
- Commit message:
- cz_odl
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Apr 20 07:47:05 2015 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" + +int analog_zero_5 = 0; +AnalogIn czujnik_odleglosci(PTC1); +Serial pc(USBTX, USBRX); + +float voltage(AnalogIn czujnik, float zero_analog) { + return (czujnik.read() - zero_analog) * 2.9035; + } + + void task1(int k) { + pc.printf("%d\t%.3f\n\r", k, voltage(czujnik_odleglosci, analog_zero_5)); + } + +int main() { + pc.baud(9600); + int k=0; + + while (true) { + + k++; + wait_ms(1000); + task1(k); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Apr 20 07:47:05 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0 \ No newline at end of file