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.
Diff: main6_2.cpp
- Revision:
- 0:ec16c632d97f
diff -r 000000000000 -r ec16c632d97f main6_2.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main6_2.cpp Wed Jan 20 04:58:54 2021 +0000
@@ -0,0 +1,16 @@
+//プログラム6_2 main6_2.cpp
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX); // PCシリアルのピン名は USBTX, USBRX
+AnalogIn ond(p15); // 温度センサ LM61 10mV/℃ 0℃ 600mV
+int main() {
+ float a,b,c;
+
+ while(1) {
+ a = ond.read(); //0(0V)~1.0(3.3V)の数値
+ b = a * 3.3; //0V ~ 3.3Vの数値
+ c = b * 100 - 60; // LM61 0.01V/℃ 0℃ 0.6V (b - 0.6)/0.01
+ pc.printf("%f V:%f ℃:%f\n", a, b, c);
+ wait(1.0);
+ }
+}