Sera / Test_potentiometer

Dependents:   Kaiduka_20210318

Revision:
0:040a825abcfa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test_potentiometer.cpp	Fri Apr 30 05:19:04 2021 +0000
@@ -0,0 +1,21 @@
+
+#include "mbed.h"
+
+AnalogIn potensio1(PA_0);    // A0 Potentiometer 1
+
+float outValue;
+
+Serial pc(USBTX, USBRX); // tx, rx tera terminal等を使用してPCにA0ピンのセンサアナログ値を表示させる
+
+void motorReverse(void);
+
+int main() {
+
+    while(1) {
+        double pot = potensio1.read();  //0-1(0V~3.3V)
+        outValue = pot;
+        pc.printf("%f, %f\r\n", pot, outValue);  //PCに表示(確認用)
+
+
+    }
+}