Kohei Yamamoto
/
esptopc
esp and pc
main.cpp@0:7634421e8e46, 2021-12-03 (annotated)
- Committer:
- asha_ndf
- Date:
- Fri Dec 03 06:21:38 2021 +0000
- Revision:
- 0:7634421e8e46
- Child:
- 1:1a5cc6ebc608
first
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
asha_ndf | 0:7634421e8e46 | 1 | #include "mbed.h" |
asha_ndf | 0:7634421e8e46 | 2 | |
asha_ndf | 0:7634421e8e46 | 3 | |
asha_ndf | 0:7634421e8e46 | 4 | Serial pc(D1, D0); // tx,rx |
asha_ndf | 0:7634421e8e46 | 5 | Serial esp(A7, A2); |
asha_ndf | 0:7634421e8e46 | 6 | |
asha_ndf | 0:7634421e8e46 | 7 | int main() |
asha_ndf | 0:7634421e8e46 | 8 | { |
asha_ndf | 0:7634421e8e46 | 9 | pc.printf("\nConnected to PC\n"); |
asha_ndf | 0:7634421e8e46 | 10 | while(1) { |
asha_ndf | 0:7634421e8e46 | 11 | if (esp.readable()){ |
asha_ndf | 0:7634421e8e46 | 12 | pc.printf("%c",esp.getc()); |
asha_ndf | 0:7634421e8e46 | 13 | } |
asha_ndf | 0:7634421e8e46 | 14 | if (pc.readable()){ |
asha_ndf | 0:7634421e8e46 | 15 | esp.printf("c",pc.getc()); |
asha_ndf | 0:7634421e8e46 | 16 | } |
asha_ndf | 0:7634421e8e46 | 17 | } |
asha_ndf | 0:7634421e8e46 | 18 | } |