Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: UiSM_Lab_5_pomiary mbed
Fork of UiSM_Lab_5_pomiary by
Diff: wszystkie_porty.cpp
- Revision:
- 0:e7d867077aec
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/wszystkie_porty.cpp Fri Apr 17 14:48:48 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
