Sample RS232 class lib inherits Serial Class

Dependencies:   mbed

main.cpp

Committer:
terrytamyh
Date:
2014-06-16
Revision:
0:87fb6735eb09

File content as of revision 0:87fb6735eb09:

#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();     
    }
}