Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 7 months ago.
is it possible?
comunicate with the usb serial of mbed nxp lpc1768 through p9(tx) and p10(rx) to another tx rx of a modem?
1 Answer
11 years, 7 months ago.
Yes it is possible to simply pass through data from one serial port to another. Here is the standard example for a serial pass-through between the PC and the p9/p10 UART:
#include "mbed.h"
Serial pc(USBTX, USBRX); // tx, rx
Serial device(p9, p10); // tx, rx
int main() {
while(1) {
if(pc.readable()) {
device.putc(pc.getc());
}
if(device.readable()) {
pc.putc(device.getc());
}
}
}