mirror of
https://github.com/Seeed-Studio/Seeed_Arduino_CAN.git
synced 2026-07-27 19:55:59 +00:00
add print can id to recv examples
This commit is contained in:
@@ -42,9 +42,16 @@ void loop()
|
||||
{
|
||||
CAN.readMsgBuf(&len, buf); // read data, len: data length, buf: data buf
|
||||
|
||||
unsigned char canId = CAN.getCanId();
|
||||
|
||||
Serial.println("-----------------------------")
|
||||
Serial.println("get data from ID: ")
|
||||
Serial.println(canId);
|
||||
|
||||
for(int i = 0; i<len; i++) // print the data
|
||||
{
|
||||
Serial.print(buf[i]);Serial.print("\t");
|
||||
Serial.print(buf[i]);
|
||||
Serial.print("\t");
|
||||
}
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user