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");