Hi,
I recently brought CAN-BUS shield for my arduino and tried to get some data from my car. It works perfectly and I have little log file with message id’s and its content. Now I want to send this messages back to multifunctional display in my car and there is a problem I can’t even get backlight on
Is there any way to debug sent message? Something like that I sent message(sendMsgBuf)()) and somehow even get it back(readMsgBuf()) without second CAN-BUS shield?
I’ve made simple program in Java which communicates with arduino through serial port and I’m sending messages in fromat
messageId,dataLength,1-8*data -> 1,8,255,255,255,255,255,255,255,255
and then in parsing and send in arduino with this code. I know it messy for now as I did not refactor it
String readString;
INT32U messageId = 0x00;
INT8U byteArrayLength = 0;
unsigned char len = 0;
unsigned char buf[8];
.
.
.
INT8U comaPosition = readString.indexOf(",");
messageId = readString.substring(0, comaPosition).toInt();
readString = readString.substring(comaPosition+1);
comaPosition = readString.indexOf(",");
byteArrayLength = readString.substring(0, comaPosition).toInt();
readString = readString.substring(comaPosition+1);
unsigned char data[byteArrayLength];
for(int i = 0; i < byteArrayLength; i++){
comaPosition = readString.indexOf(",");
data[i] = char(readString.substring(0,comaPosition).toInt());
readString = readString.substring(comaPosition+1);
}
CAN.sendMsgBuf(messageId, 0, byteArrayLength, data);
Is it good way to send data throught CAN-BUS shield? Are they in good format? As I said with this code when I sent all messages from log file I can’t even get backlight on on my multifunctional display. Thanks