1

Dependencies:   UiSM_Lab_5_pomiary mbed

Fork of L5_odczyt by abm mechatronika

Files at this revision

API Documentation at this revision

Comitter:
abm_mechatronika
Date:
Mon Apr 20 07:50:53 2015 +0000
Parent:
0:e7d867077aec
Commit message:
odczyt

Changed in this revision

UiSM_Lab_5_pomiary.lib Show annotated file Show diff for this revision Revisions of this file
cz_odleglosci.cpp Show diff for this revision Revisions of this file
fotorezystor.cpp Show diff for this revision Revisions of this file
hall_silnik.cpp Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
wszystkie_porty.cpp Show diff for this revision Revisions of this file
diff -r e7d867077aec -r dc72e2bd6abd UiSM_Lab_5_pomiary.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UiSM_Lab_5_pomiary.lib	Mon Apr 20 07:50:53 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/Mechatronics/code/UiSM_Lab_5_pomiary/#e7d867077aec
diff -r e7d867077aec -r dc72e2bd6abd cz_odleglosci.cpp
--- 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);                                   
-   }   
-}
diff -r e7d867077aec -r dc72e2bd6abd fotorezystor.cpp
--- a/fotorezystor.cpp	Fri Apr 17 14:48:48 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-#include "mbed.h"
-
-int analog_zero_0 = 0;
-AnalogIn fotorezystor(PTB0);
-Serial pc(USBTX, USBRX);
-
-float voltage(AnalogIn czujnik, float zero_analog) {
-    return (czujnik.read() - zero_analog) * 2.9035;
-    }
-
-int main() {
-    pc.baud(9600);
-    int i=0; 
-    int p=0; 
-    int r=0;
-    int k=0; 
-    float o=0;
-    float m;
-    float n;
-    float suma = m;
-    float suma2 = n;
-   
-   while(true) {
-        m = voltage(fotorezystor, analog_zero_0);    
-        if (m < 0.05)
-        {
-        p=1;
-        }
-    for (i=0; i<10; i++)
-{
-    wait_us(10);
-m = voltage(fotorezystor, analog_zero_0);
-suma = suma + m;
-}
-
-    n = voltage(fotorezystor, analog_zero_0);
-        if (n > 0.4)
-        {
-        r = 1;
-        }
-        else r=0;
-
-    for (i=0; i<10; i++)
-{
-    wait_us(10);
-n = voltage(fotorezystor, analog_zero_0);
-suma2 = suma2 + n;
-}
-
-        if ((p==1) && (r==1) && (suma>suma2))
-        {
-        pc.printf("obrot\t%.2f\n",o);
-        p=0;
-        o=o+0.25;
-        }
-        
-      pc.printf("%.d\n",k);
-      k++;
-      wait_ms(10);
-        suma = m;
-        suma2 = n;
-    }
-}
diff -r e7d867077aec -r dc72e2bd6abd hall_silnik.cpp
--- a/hall_silnik.cpp	Fri Apr 17 14:48:48 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-#include "mbed.h"
-
-int analog_zero_1 = 0;
-AnalogIn hallotron_silnik(PTB1);
-Serial pc(USBTX, USBRX);
-
-float voltage(AnalogIn czujnik, float zero_analog) {
-    return (czujnik.read() - zero_analog) * 2.9035;
-    }
-
-int main() {
-    pc.baud(9600);
-    int i=0; 
-    int p=0; 
-    int r=0; 
-    int k=0;
-    float o=0;
-    float m;
-    float n;
-    float suma = m;
-    float suma2 = n;
-   
-   while(true) {
-        m = voltage(hallotron_silnik, analog_zero_1);    
-        if (m > 1.5)
-        {
-        p=1;
-        }
-    for (i=0; i<10; i++)
-{
-    wait_us(10);
-m = voltage(hallotron_silnik, analog_zero_1);
-suma = suma + m;
-}
-
-    n = voltage(hallotron_silnik, analog_zero_1);
-        if (n < 0.9)
-        {
-        r = 1;
-        }
-        else r=0;
-
-    for (i=0; i<10; i++)
-{
-    wait_us(10);
-n = voltage(hallotron_silnik, analog_zero_1);
-suma2 = suma2 + n;
-}
-
-        if ((p==1) && (r==1) && (suma>suma2))
-        {
-        pc.printf("obrot\%.2f\n",o);
-        p=0;
-        o=o+0.25;
-        }
-     
-      pc.printf("%.d\n",k);
-      k++
-      wait_ms(10);
-        suma = m;
-        suma2 = n;
-        
-    }
-}
diff -r e7d867077aec -r dc72e2bd6abd main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Apr 20 07:50:53 2015 +0000
@@ -0,0 +1,44 @@
+#include "mbed.h"
+
+int analog_zero_0 = 0;
+int analog_zero_1 = 0;
+int analog_zero_2 = 0;
+int analog_zero_3 = 0;
+int analog_zero_4 = 0;
+int analog_zero_5 = 0;
+AnalogIn fotorezystor(PTB0);
+AnalogIn hallotron_silnik(PTB1);
+AnalogIn tensometr(PTB2);
+AnalogIn termopara(PTB3);
+AnalogIn hallotron_prasa(PTC2);
+AnalogIn czujnik_odleglosci(PTC1);
+DigitalIn indukcyjny(PTA1);
+Serial pc(USBTX, USBRX);
+Ticker triger1;
+
+float voltage(AnalogIn czujnik, float zero_analog) {
+    return (czujnik.read() - zero_analog) * 2.9035;
+    }
+    
+void task1(int k) { 
+    pc.printf("%d\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f\n\r", k, voltage(fotorezystor, analog_zero_0),
+                                    voltage(hallotron_silnik, analog_zero_1),
+                                    voltage(tensometr, analog_zero_2),
+                                    voltage(termopara, analog_zero_3),
+                                    voltage(hallotron_prasa, analog_zero_4),
+                                    voltage(czujnik_odleglosci, analog_zero_5));
+}
+
+
+                                   
+int main() {
+   pc.baud(9600);
+    int k=0;
+    
+    while (true) {
+     
+        k++;
+        wait_ms(100);
+        task1(k);                                   
+   }   
+}
\ No newline at end of file
diff -r e7d867077aec -r dc72e2bd6abd wszystkie_porty.cpp
--- a/wszystkie_porty.cpp	Fri Apr 17 14:48:48 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-#include "mbed.h"
-
-int analog_zero_0 = 0;
-int analog_zero_1 = 0;
-int analog_zero_2 = 0;
-int analog_zero_3 = 0;
-int analog_zero_4 = 0;
-int analog_zero_5 = 0;
-AnalogIn fotorezystor(PTB0);
-AnalogIn hallotron_silnik(PTB1);
-AnalogIn tensometr(PTB2);
-AnalogIn termopara(PTB3);
-AnalogIn hallotron_prasa(PTC2);
-AnalogIn czujnik_odleglosci(PTC1);
-DigitalIn indukcyjny(PTA1);
-Serial pc(USBTX, USBRX);
-Ticker triger1;
-
-float voltage(AnalogIn czujnik, float zero_analog) {
-    return (czujnik.read() - zero_analog) * 2.9035;
-    }
-    
-void task1(int k) { 
-    pc.printf("%d\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f\n\r", k, voltage(fotorezystor, analog_zero_0),
-                                    voltage(hallotron_silnik, analog_zero_1),
-                                    voltage(tensometr, analog_zero_2),
-                                    voltage(termopara, analog_zero_3),
-                                    voltage(hallotron_prasa, analog_zero_4),
-                                    voltage(czujnik_odleglosci, analog_zero_5));
-}
-
-
-                                   
-int main() {
-   pc.baud(9600);
-    int k=0;
-    
-    while (true) {
-     
-        k++;
-        wait_ms(100);
-        task1(k);                                   
-   }   
-}
\ No newline at end of file