Rosario Schiano Lo Moriello
/
Example11AccelerometerSimulator
Accelerometer simulator
main.cpp@0:8ef83d7dc88d, 2020-10-12 (annotated)
- Committer:
- rschiano
- Date:
- Mon Oct 12 15:24:01 2020 +0000
- Revision:
- 0:8ef83d7dc88d
- Child:
- 1:a31564d0b86c
Example of use of virtual com port with Tera Term
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rschiano | 0:8ef83d7dc88d | 1 | #include "mbed.h" |
rschiano | 0:8ef83d7dc88d | 2 | |
rschiano | 0:8ef83d7dc88d | 3 | Serial pc(PA_2,PA_3,115200); |
rschiano | 0:8ef83d7dc88d | 4 | char data; |
rschiano | 0:8ef83d7dc88d | 5 | int dato1 = 12345; |
rschiano | 0:8ef83d7dc88d | 6 | float dato2 = 1.2345e-21; |
rschiano | 0:8ef83d7dc88d | 7 | |
rschiano | 0:8ef83d7dc88d | 8 | int main(){ |
rschiano | 0:8ef83d7dc88d | 9 | pc.printf("Hello world!!!\r\n"); |
rschiano | 0:8ef83d7dc88d | 10 | pc.putc('T'); |
rschiano | 0:8ef83d7dc88d | 11 | pc.putc('h'); |
rschiano | 0:8ef83d7dc88d | 12 | pc.putc('i'); |
rschiano | 0:8ef83d7dc88d | 13 | pc.putc('s'); |
rschiano | 0:8ef83d7dc88d | 14 | pc.putc(' '); |
rschiano | 0:8ef83d7dc88d | 15 | pc.putc('i'); |
rschiano | 0:8ef83d7dc88d | 16 | pc.putc('s'); |
rschiano | 0:8ef83d7dc88d | 17 | pc.putc(' '); |
rschiano | 0:8ef83d7dc88d | 18 | pc.putc('p'); |
rschiano | 0:8ef83d7dc88d | 19 | pc.putc('u'); |
rschiano | 0:8ef83d7dc88d | 20 | pc.putc('t'); |
rschiano | 0:8ef83d7dc88d | 21 | pc.putc('c'); |
rschiano | 0:8ef83d7dc88d | 22 | pc.putc('\r'); |
rschiano | 0:8ef83d7dc88d | 23 | pc.putc('\n'); |
rschiano | 0:8ef83d7dc88d | 24 | pc.printf("The first value is %d and the second value is %e\r\n",dato1,dato2); |
rschiano | 0:8ef83d7dc88d | 25 | while(1){ |
rschiano | 0:8ef83d7dc88d | 26 | data=pc.getc(); |
rschiano | 0:8ef83d7dc88d | 27 | pc.putc(data); |
rschiano | 0:8ef83d7dc88d | 28 | if(data=='\r') |
rschiano | 0:8ef83d7dc88d | 29 | pc.putc('\n'); |
rschiano | 0:8ef83d7dc88d | 30 | } |
rschiano | 0:8ef83d7dc88d | 31 | } |