Data format conversion issues / OBD can bus shield

Hi,

I've playing around with a can bus shield from seeed, and I got totally stuck with it. Googling for a few hours led to a lot of results but nothing that fits the question.

I used a slightly modified merge of two examples. Where I got stuck is that all the examples I find use either predefined libraries (for other can bus boards), or just something with an unsigned char[8]. But I don't have a clue how to translate this to the OBD codes which are in the format like 010C.

Are these values supposed to be hexadecimal? Since the previous attempt resulted in a lot of error messages on the car's dashboard it seems better to me to stop experimenting and just ask for help, before seriously erasing something in the car's computer.

many thanks!

This is what I used:

#include <SPI.h>
#include <mcp_can.h>
INT32U canId = 0x000;

unsigned char len = 0;
unsigned char buff[8];
char str[20];

const int SPI_CS_PIN = 10; // select your can shield cs pin

MCP_CAN CAN(SPI_CS_PIN); // Set CS pin
void setup()
{ 
Serial.begin(9600);
START_INIT:
if(CAN_OK == CAN.begin(CAN_125KBPS))
{
Serial.println("CAN BUS Shield init ok!");
}
else
{
Serial.println("CAN BUS Shield init fail");
Serial.println("Init CAN BUS Shield again");
delay(100);
goto START_INIT;
}
}

unsigned char stmp[8] = {0x02, 0x01, 0x00, 0, 0, 0, 0, 0}; // actual values are a previous test, send-rpm  should be 010C
void loop(){


CAN.sendMsgBuf(0x7DF, 0, 8, stmp);    
  
if(CAN_MSGAVAIL == CAN.checkReceive())
{
CAN.readMsgBuf(&len, buff);
canId = CAN.getCanId();

Serial.print(canId);Serial.print(",");
for(int i = 0; i<len; i++)
{
Serial.print(buff[i]);Serial.print(",");
}
Serial.println();
}
}

The message ended up in a wrong forum. My mistake, I've asked a moderator to move it.

Is my assumption correct that the correct value would be this?

unsigned char stmp[8] = {0,0,0,0,0x30, 0x31, 0x30, 0x43};