Hi all.
Having a little trouble extracting bytes from a CAN_FRAME class.
Trying this…
CAN_FRAME ChalFrame;
CAN_FRAME RespFrame;
Can0.watchFor(0x00040020);
if (Can0.available() > 0)
{
Can0.read(ChalFrame);
// Split the Challenge into raw bytes
ChalByte[0] = (ChalFrame & 0xFF000000)>>24;
ChalByte[1] = (ChalFrame & 0x00FF0000)>>16;
ChalByte[2] = (ChalFrame & 0x0000FF00)>>8;
ChalByte[3] = (ChalFrame & 0x000000FF);
Gives error message “no match for ‘operator&’ (operand types are ‘CAN_FRAME’ and ‘unsigned int’)” in Arduino IDE.
I need to extract these bytes, modify them individually, then reassemble and send.
If you have any pointers please let me know!
Thanks
Joe