read write test for UART/RS232, debug via USB
Dependencies: mbed
Fork of DataLoggerRS232trial by
Diff: main.cpp
- Revision:
- 0:87fb6735eb09
- Child:
- 1:875d121e9ce9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Jun 16 23:05:40 2014 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "DataLoggerRS232.h" + +Serial pc (USBTX, USBRX); // tx, rx +DataLoggerRS232 dataLogger (p9,p10); // tx, rx + +char DLcommand; + +int main() { + + pc.baud(115200); + pc.printf("PC and Datalogger serial set up complete !!\n\r"); + dataLogger.baud(115200); + pc.printf("Here !!\n\r"); + + while(1) { + if(pc.readable()) { + + dataLogger.count = 0; + DLcommand = pc.getc(); + pc.printf("\n\r%c\n\r",DLcommand); + + dataLogger.putc(DLcommand); + dataLogger.get_ECU_databyte(); + } + dataLogger.display_ECU_databyte(); + } +} \ No newline at end of file