attempt at producing a working Software Serial UART. LIBRARY DOES NOT YET WORK COMPLETELY.

Dependencies:   mbed SoftwareSerial

Committer:
chag
Date:
Sat Mar 17 17:27:43 2012 +0000
Revision:
0:6b23f6c9cdf1

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chag 0:6b23f6c9cdf1 1 #include "mbed.h"
chag 0:6b23f6c9cdf1 2 #include "SoftwareSerial.h"
chag 0:6b23f6c9cdf1 3
chag 0:6b23f6c9cdf1 4 Serial pc(USBTX, USBRX);
chag 0:6b23f6c9cdf1 5 SoftwareSerial ss(p19, p20);
chag 0:6b23f6c9cdf1 6
chag 0:6b23f6c9cdf1 7
chag 0:6b23f6c9cdf1 8 int main() {
chag 0:6b23f6c9cdf1 9 pc.baud(115200);
chag 0:6b23f6c9cdf1 10 pc.putc('\f');
chag 0:6b23f6c9cdf1 11 pc.printf("==== MBED Serial Proxy ====\r\n");
chag 0:6b23f6c9cdf1 12
chag 0:6b23f6c9cdf1 13 wait(2);
chag 0:6b23f6c9cdf1 14 ss.baud(300);
chag 0:6b23f6c9cdf1 15 wait(2);
chag 0:6b23f6c9cdf1 16
chag 0:6b23f6c9cdf1 17 while(1) {
chag 0:6b23f6c9cdf1 18 if(pc.readable()) ss.putc(pc.getc());
chag 0:6b23f6c9cdf1 19 if(ss.readable()) pc.putc(ss.getc());
chag 0:6b23f6c9cdf1 20 }
chag 0:6b23f6c9cdf1 21 }
chag 0:6b23f6c9cdf1 22
chag 0:6b23f6c9cdf1 23