jajajja

Dependencies:   SoftSerial mbed

Committer:
sick010203
Date:
Sat Jun 03 17:50:12 2017 +0000
Revision:
0:2829e7973b41
Hola SerialMaestro

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sick010203 0:2829e7973b41 1 #include "mbed.h"
sick010203 0:2829e7973b41 2 #include "SoftSerial.h"
sick010203 0:2829e7973b41 3 #include <string>
sick010203 0:2829e7973b41 4 SoftSerial micro(D2,D3);
sick010203 0:2829e7973b41 5 Serial pc (USBTX, USBRX);
sick010203 0:2829e7973b41 6 DigitalOut bad(LED2);
sick010203 0:2829e7973b41 7
sick010203 0:2829e7973b41 8
sick010203 0:2829e7973b41 9 int main () {
sick010203 0:2829e7973b41 10 micro.baud(9600);
sick010203 0:2829e7973b41 11 pc.baud(9600);
sick010203 0:2829e7973b41 12
sick010203 0:2829e7973b41 13 string readString;
sick010203 0:2829e7973b41 14 char message [125];
sick010203 0:2829e7973b41 15
sick010203 0:2829e7973b41 16 while(1){
sick010203 0:2829e7973b41 17 while (micro.writeable())
sick010203 0:2829e7973b41 18 {
sick010203 0:2829e7973b41 19 bad=!bad;
sick010203 0:2829e7973b41 20 wait(0.05);
sick010203 0:2829e7973b41 21 pc.gets(message,5);
sick010203 0:2829e7973b41 22 readString += message;
sick010203 0:2829e7973b41 23 pc.printf("%s\r\n", readString);
sick010203 0:2829e7973b41 24 wait(0.03);
sick010203 0:2829e7973b41 25 micro.printf("%s\r\n", readString);
sick010203 0:2829e7973b41 26 break;
sick010203 0:2829e7973b41 27
sick010203 0:2829e7973b41 28 }
sick010203 0:2829e7973b41 29 readString="";
sick010203 0:2829e7973b41 30 }
sick010203 0:2829e7973b41 31 }