mauricio cadena
/
serial3
Comunicación serial de pc a pc con tierra común con tarjeta núcleo F334R8
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "SoftSerial.h" 00003 #include <string> 00004 // comunicacion serial de pc a pc con tierra comun, tarjeta nucle F334R8, Nombres del grupo Ricardo Rozo, Mauricio Cadena, Andres Usma 00005 DigitalOut Led(LED2); 00006 00007 Serial pc(USBTX,USBRX); 00008 SoftSerial ST(D6,D7); 00009 char recibir; 00010 00011 00012 int main (){ 00013 00014 pc.baud(9600); 00015 ST.baud(9600); 00016 wait(0.1); 00017 00018 while (1) 00019 { 00020 while (pc.readable()>0) 00021 { 00022 ST.putc(pc.getc()); 00023 00024 } 00025 00026 while (ST.readable()>0) 00027 { 00028 pc.putc(ST.getc()); 00029 } 00030 wait(0.01); 00031 if (ST.readable()>0) 00032 { 00033 recibir=ST.getc(); 00034 //LED=!LED; 00035 pc.printf("%c",recibir); 00036 wait(0.5); 00037 } 00038 } 00039 }
Generated on Mon Jul 18 2022 00:38:54 by 1.7.2