Samuel Mokrani
/
USBSerial_Echo
USBSerial echo example
main.cpp@7:6372a14f105d, 2012-12-20 (annotated)
- Committer:
- samux
- Date:
- Thu Dec 20 17:06:44 2012 +0000
- Revision:
- 7:6372a14f105d
- Parent:
- 5:fa2fa6aa36b1
use latest version of USBDevice
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
samux | 0:5cd54b826046 | 1 | #include "mbed.h" |
samux | 0:5cd54b826046 | 2 | #include "USBSerial.h" |
samux | 7:6372a14f105d | 3 | |
samux | 0:5cd54b826046 | 4 | //Virtual serial port over USB |
samux | 0:5cd54b826046 | 5 | USBSerial serial; |
samux | 0:5cd54b826046 | 6 | Serial pc(USBTX, USBRX); |
samux | 7:6372a14f105d | 7 | |
samux | 0:5cd54b826046 | 8 | int main(void) { |
samux | 5:fa2fa6aa36b1 | 9 | uint8_t buf[128]; |
samux | 0:5cd54b826046 | 10 | while(1) |
samux | 0:5cd54b826046 | 11 | { |
samux | 0:5cd54b826046 | 12 | serial.scanf("%s", buf); |
samux | 5:fa2fa6aa36b1 | 13 | serial.printf("recv: %s\r\n", buf); |
samux | 5:fa2fa6aa36b1 | 14 | pc.printf("recv: %s\r\n", buf); |
samux | 0:5cd54b826046 | 15 | } |
samux | 7:6372a14f105d | 16 | } |