sergio burbano
/
chat_serial
Grupo 3 wilmer Pardo Sergio Burbano Daniel Paez
Diff: main.cpp
- Revision:
- 0:8cab7e1b82e8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Sep 23 21:37:18 2017 +0000 @@ -0,0 +1,44 @@ +#include "mbed.h" +#include "SoftSerial.h" + +SoftSerial nucleo (D8,D9); +Serial pc(SERIAL_TX, SERIAL_RX); +char sent,rec; +int i =0; + +char msm[25]= {}; +int main() +{ + + + + while(1) { + + if (pc.readable()>0) { + sent=pc.getc(); + if(sent == 13) { + for (int j = 0; j<i; j++) { + nucleo.printf("%c",msm[j]); + pc.printf("%c",msm[j]); + wait(0.01); + } + nucleo.printf("\n\r"); + pc.printf("\n\r"); + + i=0; + } else { + msm[i]= sent; + i++; + } + } + if(nucleo.readable()>0) { + rec=nucleo.getc(); + pc.printf("%c",rec); + wait(0.01); + + + } + + } + } +