Used to create a USB -> Serial link between a PC and a serial device
Connect your serial device to p28 (tx) and p27 (rx). Change the baud rate to match your device. The baud rate must be the same for Serial pc and Serial device.
main.cpp
- Committer:
- joe4465
- Date:
- 2014-09-18
- Revision:
- 0:8e51213bffbc
File content as of revision 0:8e51213bffbc:
#include "mbed.h" DigitalOut myled(LED1); Serial pc(USBTX, USBRX); // tx, rx Serial device(p28, p27); // tx, rx int main() { device.baud(115200); pc.baud(115200); while(1) { if(pc.readable()) { device.putc(pc.getc()); } if(device.readable()) { myled = !myled; pc.putc(device.getc()); } } }