Hi guys,
I am working with the mcp2515 CAN BUS adapter board with an Arduino Nano, I have managed to read the CANBUS data from the VESC speed controller that I am getting the CAN data from.
However I now want to display those values on an OLED display, basically need to filter each section of data out and assign it to a variable. I have tried a few methods but nothing is working. Does anyone have any tips?
Thanks a lot!
CAN ID, DLC, DATA Received
80000967 8 0 0 0 0 FF FF 0 1 | |
---|---|
80000E67 8 0 0 0 0 0 0 0 0 | |
80001B67 8 0 0 0 2 0 A2 0 0 | |
80000F67 8 0 0 0 0 0 0 0 0 |
if (mcp2515.readMessage(&canMsg) == MCP2515::ERROR_OK) {
//Serial.print(0x001B, HEX); // print ID
//Serial.print(canMsg.can_id, HEX); // print ID
//Serial.print(" ");
//Serial.print(canMsg.can_dlc, HEX); // print DLC
//Serial.print(" ");
if(canMsg.can_id == 0x001B, HEX)
{
//int x = canMsg.data[6];
//Serial.println(x);
//Serial.print(canMsg.data[6]);
for (int i = 5; i<canMsg.can_dlc; i++) { // print the data
Serial.print(canMsg.data[i], HEX);
Serial.print(" ");
}
Serial.println();
}
}