PEDRO MATIZ
/
CHATSERIAL
CHAT SERIAL
Diff: main.cpp
- Revision:
- 0:6f1384d9a913
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Sep 30 21:03:52 2017 +0000 @@ -0,0 +1,50 @@ +//CODIGO PAR EL CHAT SERIAL + +#include "mbed.h" +#include "SoftSerial.h" +#include <string> +/******************************************************************************/ +char c; +SoftSerial con(D4,D5);//tx.rx +Serial pc(USBTX,USBRX); + +/******************************************************************************/ + + +int main (){ + //AnalogIn ai(A0); + //lcd.locate(0,0); + //wait(0.1); + //lcd.locate(0,0); + con.baud(9600); + pc.baud(9600); + + wait(0.1); + + //lcd.cls(); + while (1) + { + while (pc.readable()>0) + { + con.putc(pc.getc()); + + } + + while (con.readable()>0) + { + pc.putc(con.getc()); + //lcd.printf("%s",readString); + } + wait(0.01); + + if (con.readable()>0) + { + c=con.getc(); + + pc.printf("%c",c); + //lcd.printf("%s",readString); + wait(0.5); + } + + } +} \ No newline at end of file