Hi to all friends
i want to start a project that will use Can Bus for communication between a raspberry pi zero and an Arduino Nano ( At my first steps will use just only to Arduino Nano to communicate each other that would be more easy i think and later will try to make it work and with raspberry)
so my hardware will be
2 Arduino Nanos
2 mcp2515 can bus modules
for library i will use this one :
My Question :
As i have understand until now from the examples and the articles i have read is that every time you send a message first is the Can id (device id) and second the Can dlc (data length) and then the data
something like this :
canMsg1.can_id = 0x0F6;
canMsg1.can_dlc = 8;
canMsg1.data[0] = 0x8E;
canMsg1.data[1] = 0x87;
canMsg1.data[2] = 0x32;
canMsg1.data[3] = 0xFA;
canMsg1.data[4] = 0x26;
canMsg1.data[5] = 0x8E;
canMsg1.data[6] = 0xBE;
canMsg1.data[7] = 0x86;
So if i want to sent in one message the state of 8 pins if there are low or high can i use each data position for that? and if i want to send 8 more I/O pins state have to use a second Message like :
canMsg2.can_id = 0x05F;
or should i use for each I/O pin state a new message ?
thanks in advance