echo characters typed on USB debug port
Dependencies: mbed
main.cpp@0:279c532226c8, 2015-12-02 (annotated)
- Committer:
- mfiore
- Date:
- Wed Dec 02 16:11:54 2015 +0000
- Revision:
- 0:279c532226c8
- Child:
- 1:43abfdd0709b
initial commit - 115k baud, echo characters typed on USB debug port
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mfiore | 0:279c532226c8 | 1 | // this program echos on the USB debug port |
mfiore | 0:279c532226c8 | 2 | |
mfiore | 0:279c532226c8 | 3 | #include "mbed.h" |
mfiore | 0:279c532226c8 | 4 | |
mfiore | 0:279c532226c8 | 5 | int main() { |
mfiore | 0:279c532226c8 | 6 | Serial usb(USBTX, USBRX); |
mfiore | 0:279c532226c8 | 7 | |
mfiore | 0:279c532226c8 | 8 | // change the following value to change the baud rate |
mfiore | 0:279c532226c8 | 9 | usb.baud(115200); |
mfiore | 0:279c532226c8 | 10 | |
mfiore | 0:279c532226c8 | 11 | while (true) |
mfiore | 0:279c532226c8 | 12 | if (usb.readable()) |
mfiore | 0:279c532226c8 | 13 | usb.putc(usb.getc()); |
mfiore | 0:279c532226c8 | 14 | } |