lab sensory - program 1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Kuba_M
Date:
Fri Mar 27 10:52:36 2015 +0000
Commit message:
message

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 237dc6936523 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Mar 27 10:52:36 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" ,voltage(czujnik_odleglosci, analog_zero_5);
+     }
+     
+int main() {
+    pc.baud(9600);
+    int k=0;
+    
+    while (true) {
+     
+        k++;
+        wait_ms(100);
+        task1(k);                                   
+   }   
+}
diff -r 000000000000 -r 237dc6936523 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Mar 27 10:52:36 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0
\ No newline at end of file