analog giriş örneği

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ctasdemir
Date:
Fri May 11 05:06:30 2018 +0000
Commit message:
analog giri? ?rne?i

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 b8cafb83c1f8 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri May 11 05:06:30 2018 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+
+AnalogIn analog_value(A0); //A0 girişi Analog giriş
+DigitalOut led(LED1);
+Serial pc(USBTX, USBRX);
+
+
+int main()
+{
+    float meas_r;
+    float meas_v;
+    
+    pc.printf("\nAnalogIn Ornegi\n\r");
+
+    while(1) {
+
+        meas_r = analog_value.read(); 
+        meas_v = meas_r * 3300; // ADC değerini mV değerine çeviriyoruz
+        
+        // Değerleri PC'ye yolla
+        pc.printf("Ham ADC Degeri[0-1] = %f = %.0f mV\n", meas_r, meas_v);        
+
+        wait(1.0); // 1 second
+    }
+}
diff -r 000000000000 -r b8cafb83c1f8 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri May 11 05:06:30 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/fb8e0ae1cceb
\ No newline at end of file