mauricio cadena
/
serial3
Comunicación serial de pc a pc con tierra común con tarjeta núcleo F334R8
Diff: main.cpp
- Revision:
- 0:c760f6105125
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Sep 23 21:03:42 2017 +0000 @@ -0,0 +1,39 @@ +#include "mbed.h" +#include "SoftSerial.h" +#include <string> +// comunicacion serial de pc a pc con tierra comun, tarjeta nucle F334R8, Nombres del grupo Ricardo Rozo, Mauricio Cadena, Andres Usma +DigitalOut Led(LED2); + +Serial pc(USBTX,USBRX); +SoftSerial ST(D6,D7); +char recibir; + + +int main (){ + + pc.baud(9600); + ST.baud(9600); + wait(0.1); + + while (1) + { + while (pc.readable()>0) + { + ST.putc(pc.getc()); + + } + + while (ST.readable()>0) + { + pc.putc(ST.getc()); + } + wait(0.01); + if (ST.readable()>0) + { + recibir=ST.getc(); + //LED=!LED; + pc.printf("%c",recibir); + wait(0.5); + } + } +} \ No newline at end of file