Comunicación serial de pc a pc con tierra común con tarjeta núcleo F334R8

Dependencies:   SoftSerial mbed

main.cpp

Committer:
mauricio1989
Date:
2017-09-23
Revision:
0:c760f6105125

File content as of revision 0:c760f6105125:

#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);                
                }
    }
}