mirror of
https://github.com/Seeed-Studio/Seeed_Arduino_CAN.git
synced 2026-07-27 19:55:59 +00:00
Always store CAN IDs as unsigned long.
Explicitly show that the CAN ID is printed in HEX.
This commit is contained in:
@@ -97,7 +97,7 @@ void taskCanRecv()
|
||||
CAN.readMsgBuf(&len, buf); // read data, len: data length, buf: data buf
|
||||
|
||||
Serial.println("\r\n------------------------------------------------------------------");
|
||||
Serial.print("Get Data From id: ");
|
||||
Serial.print("Get Data From id: 0x");
|
||||
Serial.println(CAN.getCanId(), HEX);
|
||||
for(int i = 0; i<len; i++) // print the data
|
||||
{
|
||||
|
||||
@@ -37,11 +37,11 @@ void loop()
|
||||
{
|
||||
CAN.readMsgBuf(&len, buf); // read data, len: data length, buf: data buf
|
||||
|
||||
unsigned char canId = CAN.getCanId();
|
||||
unsigned long canId = CAN.getCanId();
|
||||
|
||||
Serial.println("-----------------------------");
|
||||
Serial.println("get data from ID: ");
|
||||
Serial.println(canId);
|
||||
Serial.println("get data from ID: 0x");
|
||||
Serial.println(canId, HEX);
|
||||
|
||||
for(int i = 0; i<len; i++) // print the data
|
||||
{
|
||||
|
||||
@@ -36,10 +36,10 @@ void loop()
|
||||
{
|
||||
CAN.readMsgBuf(&len, buf); // read data, len: data length, buf: data buf
|
||||
|
||||
unsigned int canId = CAN.getCanId();
|
||||
unsigned long canId = CAN.getCanId();
|
||||
|
||||
Serial.println("-----------------------------");
|
||||
Serial.print("Get data from ID: ");
|
||||
Serial.print("Get data from ID: 0x");
|
||||
Serial.println(canId, HEX);
|
||||
|
||||
for(int i = 0; i<len; i++) // print the data
|
||||
|
||||
Reference in New Issue
Block a user