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.
main6_2.cpp@0:ec16c632d97f, 2021-01-20 (annotated)
- Committer:
- esemi00
- Date:
- Wed Jan 20 04:58:54 2021 +0000
- Revision:
- 0:ec16c632d97f
esemi00
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| esemi00 | 0:ec16c632d97f | 1 | //プログラム6_2 main6_2.cpp |
| esemi00 | 0:ec16c632d97f | 2 | #include "mbed.h" |
| esemi00 | 0:ec16c632d97f | 3 | |
| esemi00 | 0:ec16c632d97f | 4 | Serial pc(USBTX, USBRX); // PCシリアルのピン名は USBTX, USBRX |
| esemi00 | 0:ec16c632d97f | 5 | AnalogIn ond(p15); // 温度センサ LM61 10mV/℃ 0℃ 600mV |
| esemi00 | 0:ec16c632d97f | 6 | int main() { |
| esemi00 | 0:ec16c632d97f | 7 | float a,b,c; |
| esemi00 | 0:ec16c632d97f | 8 | |
| esemi00 | 0:ec16c632d97f | 9 | while(1) { |
| esemi00 | 0:ec16c632d97f | 10 | a = ond.read(); //0(0V)~1.0(3.3V)の数値 |
| esemi00 | 0:ec16c632d97f | 11 | b = a * 3.3; //0V ~ 3.3Vの数値 |
| esemi00 | 0:ec16c632d97f | 12 | c = b * 100 - 60; // LM61 0.01V/℃ 0℃ 0.6V (b - 0.6)/0.01 |
| esemi00 | 0:ec16c632d97f | 13 | pc.printf("%f V:%f ℃:%f\n", a, b, c); |
| esemi00 | 0:ec16c632d97f | 14 | wait(1.0); |
| esemi00 | 0:ec16c632d97f | 15 | } |
| esemi00 | 0:ec16c632d97f | 16 | } |