EDIT:
Oh I think that now I see where is problem. I’m trying tp get message id before reading message. So this mean that I get id from previous message. Am I right?
Hi,
I tried to read data from my car through Can bus shield but I found problem. First I couldn’t read messages at all because of this problem but yesterday I found out what’s the matter. I’m using your example code with addition of getting message id.
[code]
INT32U canId = 0x000;
.
.
.
void loop()
{
if(CAN_MSGAVAIL == CAN.checkReceive()) // check if data coming
{
canId = CAN.getCanId();
CAN.readMsgBuf(&len, buf); // read data, len: data length, buf: data buf
Serial.print("<");Serial.print(canId);Serial.print(":\t");
for(int i = 0; i<len; i++) // print the data
{
Serial.print(buf[i]);Serial.print(",\t");
}
Serial.println();
}
}[/code]
Everything is OK but message ID for actual message is sent in next line as you can see in this example.
.
.
.
<1BE: 32, 31, 30, 34, 32, 31, 31, 34> -> This should be 2B6 instead of 1BE
<2B6: F2, 00, 00, 00, 00, FF, 00, 00> -> This should be 217 instead of 2B6
<217: 00, 00, 00, 00, 00, 00, 11, D0> -> This should be next line message id instead of 217
.
.
.