Problems sending data thru I2C

My problem is that I recieve CAN data in the form of a Char* but then I try to pass that to another arduino board then I2C but all I get is junk data is there a way to either parse it to multiple char then send the data or something else. Also the canData variable is only eight bytes. Any suggustion would be much appreciated.
Here is sample of the code on master:

    /* This is the method to receieve CAN messages */
    canData = Canbus.set_relay(buffer);
    
    /* Checks for flag to determine if message 
       is for the second board */ 
    secondBoardFlag = !!(canData[7] & 0xFE);
    
    if(secondBoardFlag == 1)
    {
     Wire.beginTransmission(4); // transmit to device #4
      Wire.send(canData);
     Wire.endTransmission();    // stop transmitting
    }

and here is the slave code:

    *canData = Wire.receive(); /* Receive byte as a character */
    test = canData[0];
    Serial.print(test);         /* Print the character thru serial */
    Serial.print("\n");

Incomplete code snippets are hard to debug as datatypes etc are unknown to us....

Wire.receive() does normally receive a char or better an uint8_t (insigned int 8 bit)

try this @slave side

char c = Wire.receive();
Serial.print(c, HEX); // show the hex value of the char to print
Serial.print(" : ");
Serial.println(c); // show the char as char

Thanks for the help, I figured out that I was not sending the data wrong per se but in the wrong way and now its all working thats for the help

maybe you can post your working coding for other who have a similar problem?

robtillaart:
maybe you can post your working coding for other who have a similar problem?

I hate when people don't do that...makes it impossible to figure out when you have the same issue :slight_smile:

Please share your code that made it work in case others come across the same problem.