Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: libmDot mbed-rtos mbed
Fork of power_meter by
main.cpp
- Committer:
- Dengjj
- Date:
- 2016-09-18
- Revision:
- 2:6ebf09171de9
- Parent:
- 1:875d121e9ce9
- Child:
- 3:47839ac143d3
File content as of revision 2:6ebf09171de9:
#include "mbed.h"
#include "DataLoggerRS232.h"
Serial pc (USBTX, USBRX); // tx, rx
Serial dataLogger (PA_2,PA_3); // tx, rx
//char DLcommand;
int abc[]={104,87,36,19,0,0,0,104,17,4,51,51,51,51,63,22};
char DLcommand2;
int main() {
pc.baud(115200);
pc.printf("PC and Datalogger serial set up complete !!\n\r");
dataLogger.baud(2400);
dataLogger.format(9,SerialBase::Even,1);
pc.printf("Here !!\n\r");
int i;
const int m=16;
while(1) {
i=0;
// if(pc.readable()) {
if(dataLogger.writeable()){
for(i=0;i<m;i++){
dataLogger.putc(abc[i]);
}
pc.printf("T");
// dataLogger.printf("%c",DLcommand);
// 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();
// wait(4);
//-----------------------------------------------
if(dataLogger.readable()) {
pc.printf("R");
char DLcommand[25];
// dataLogger.count = 0;
for(i=0;i<25;i++){
DLcommand[i]= dataLogger.getc();
pc.putc(DLcommand[i]);
}
// DLcommand = dataLogger.getc();
// DLcommand2 = dataLogger.getc();
;
// pc.printf("\n\r%c\n\r",DLcommand2);
// dataLogger.putc(DLcommand);
// dataLogger.get_ECU_databyte();
}
// dataLogger.display_ECU_databyte();
wait(4);
}}
