1
Dependencies: UiSM_Lab_5_pomiary mbed
Fork of L5_odczyt by
Diff: cz_odleglosci.cpp
- Revision:
- 1:dc72e2bd6abd
- Parent:
- 0:e7d867077aec
--- a/cz_odleglosci.cpp Fri Apr 17 14:48:48 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -#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); - } -}