masayushi nisino
/
tera
1
teraterm.cpp@1:e158a9e81a9a, 2014-11-14 (annotated)
- Committer:
- 12f2039e
- Date:
- Fri Nov 14 09:37:10 2014 +0000
- Revision:
- 1:e158a9e81a9a
- Parent:
- 0:6dd7f7b13aa8
a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
12f2039e | 0:6dd7f7b13aa8 | 1 | #include "mbed.h" |
12f2039e | 0:6dd7f7b13aa8 | 2 | #include "USBSerial.h" |
12f2039e | 0:6dd7f7b13aa8 | 3 | |
12f2039e | 0:6dd7f7b13aa8 | 4 | DigitalIn sw(P0_1); |
12f2039e | 1:e158a9e81a9a | 5 | AnalogIn sensor1(P0_14); |
12f2039e | 1:e158a9e81a9a | 6 | AnalogIn sensor2(P0_12); |
12f2039e | 1:e158a9e81a9a | 7 | AnalogIn sensor3(P0_22); |
12f2039e | 1:e158a9e81a9a | 8 | AnalogIn sensor4(P0_23); |
12f2039e | 1:e158a9e81a9a | 9 | //AnalogIn sensor5(P0_22); |
12f2039e | 0:6dd7f7b13aa8 | 10 | |
12f2039e | 0:6dd7f7b13aa8 | 11 | DigitalOut led(P1_28); |
12f2039e | 0:6dd7f7b13aa8 | 12 | |
12f2039e | 0:6dd7f7b13aa8 | 13 | USBSerial vcom; |
12f2039e | 0:6dd7f7b13aa8 | 14 | |
12f2039e | 0:6dd7f7b13aa8 | 15 | int main(){ |
12f2039e | 1:e158a9e81a9a | 16 | float hoge1, hoge2, hoge3, hoge4/*, hoge5*/; |
12f2039e | 0:6dd7f7b13aa8 | 17 | while(1){ |
12f2039e | 0:6dd7f7b13aa8 | 18 | hoge1 = sensor1.read(); |
12f2039e | 0:6dd7f7b13aa8 | 19 | hoge2 = sensor2.read(); |
12f2039e | 0:6dd7f7b13aa8 | 20 | hoge3 = sensor3.read(); |
12f2039e | 0:6dd7f7b13aa8 | 21 | hoge4 = sensor4.read(); |
12f2039e | 1:e158a9e81a9a | 22 | //hoge5 = sensor5.read(); |
12f2039e | 0:6dd7f7b13aa8 | 23 | if(sw==0){ |
12f2039e | 0:6dd7f7b13aa8 | 24 | vcom.printf("\033[%d;%dH", 0,0); |
12f2039e | 0:6dd7f7b13aa8 | 25 | vcom.printf("sensor1=%7.6f\n\r", hoge1); |
12f2039e | 0:6dd7f7b13aa8 | 26 | vcom.printf("sensor2=%7.6f\n\r", hoge2); |
12f2039e | 0:6dd7f7b13aa8 | 27 | vcom.printf("sensor3=%7.6f\n\r", hoge3); |
12f2039e | 0:6dd7f7b13aa8 | 28 | vcom.printf("sensor4=%7.6f\n\r", hoge4); |
12f2039e | 1:e158a9e81a9a | 29 | //vcom.printf("sensor5=%7.6f\n\r", hoge5); |
12f2039e | 0:6dd7f7b13aa8 | 30 | led = 1; |
12f2039e | 0:6dd7f7b13aa8 | 31 | } |
12f2039e | 0:6dd7f7b13aa8 | 32 | else{ |
12f2039e | 0:6dd7f7b13aa8 | 33 | led = 0; |
12f2039e | 0:6dd7f7b13aa8 | 34 | } |
12f2039e | 0:6dd7f7b13aa8 | 35 | } |
12f2039e | 0:6dd7f7b13aa8 | 36 | } |