example serial
Dependencies: mbed
Fork of mDot_Serial_Example by
Diff: main.cpp
- Revision:
- 2:d98cfa3851de
- Parent:
- 1:d2ee7143632f
--- a/main.cpp Fri Oct 02 15:23:02 2015 +0000 +++ b/main.cpp Tue Jan 24 10:54:54 2017 +0000 @@ -11,11 +11,36 @@ */ #include "mbed.h" +#include <string> + + + //Serial pc(USBTX, USBRX); + + //Serial pc(PA_2, PA_3); + + Serial pc(USBTX, USBRX); + +Serial device(PA_2, PA_3); // tx, rx + int main() { - Serial pc(USBTX, USBRX); - - while (true) - if (pc.readable()) - pc.putc(pc.getc()); -} \ No newline at end of file + device.baud(9600); + while(1) { + /*(pc.readable()) { + device.putc(pc.getc()); + + }*/ + + + + //delay(500); + if(device.readable()) { + pc.putc('h'); + pc.putc('\r'); + // pc.putc(device.getc()); + } + } +} + + +