Ian Wolf
/
TestSerialRead
REV1
main.cpp@0:3fe66c61112d, 2017-08-22 (annotated)
- Committer:
- iwolf32
- Date:
- Tue Aug 22 19:59:54 2017 +0000
- Revision:
- 0:3fe66c61112d
Rev1;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
iwolf32 | 0:3fe66c61112d | 1 | #include "mbed.h" |
iwolf32 | 0:3fe66c61112d | 2 | #include <string> |
iwolf32 | 0:3fe66c61112d | 3 | |
iwolf32 | 0:3fe66c61112d | 4 | Serial pc(SERIAL_TX, SERIAL_RX); |
iwolf32 | 0:3fe66c61112d | 5 | |
iwolf32 | 0:3fe66c61112d | 6 | int main() { |
iwolf32 | 0:3fe66c61112d | 7 | pc.baud(250000); |
iwolf32 | 0:3fe66c61112d | 8 | char c[5]; |
iwolf32 | 0:3fe66c61112d | 9 | while (pc.readable()) { |
iwolf32 | 0:3fe66c61112d | 10 | pc.scanf("%s", &c); |
iwolf32 | 0:3fe66c61112d | 11 | } |
iwolf32 | 0:3fe66c61112d | 12 | |
iwolf32 | 0:3fe66c61112d | 13 | pc.printf(c); |
iwolf32 | 0:3fe66c61112d | 14 | |
iwolf32 | 0:3fe66c61112d | 15 | } |