Luca Mottola
/
AthensFall19-STDinSTDout
STDin and STDout example
main.cpp@0:8c4e69ec8e4d, 2018-11-08 (annotated)
- Committer:
- lmottola
- Date:
- Thu Nov 08 13:56:07 2018 +0000
- Revision:
- 0:8c4e69ec8e4d
- Child:
- 1:2f9d56e97f30
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lmottola | 0:8c4e69ec8e4d | 1 | #include "mbed.h" |
lmottola | 0:8c4e69ec8e4d | 2 | |
lmottola | 0:8c4e69ec8e4d | 3 | DigitalOut myled(LED1); |
lmottola | 0:8c4e69ec8e4d | 4 | Serial pc(USBTX, USBRX); |
lmottola | 0:8c4e69ec8e4d | 5 | |
lmottola | 0:8c4e69ec8e4d | 6 | int main() { |
lmottola | 0:8c4e69ec8e4d | 7 | char buffer[128]; |
lmottola | 0:8c4e69ec8e4d | 8 | |
lmottola | 0:8c4e69ec8e4d | 9 | pc.printf("Starting..\n"); |
lmottola | 0:8c4e69ec8e4d | 10 | |
lmottola | 0:8c4e69ec8e4d | 11 | while (1) { |
lmottola | 0:8c4e69ec8e4d | 12 | pc.gets(buffer, 4); |
lmottola | 0:8c4e69ec8e4d | 13 | pc.printf("I got '%s'\n", buffer); |
lmottola | 0:8c4e69ec8e4d | 14 | } |
lmottola | 0:8c4e69ec8e4d | 15 | } |