| 12345678910111213141516171819202122232425262728293031323334 |
- void CAN_READ() {
- // If pin 2 is low, read receive buffer
- {
- CAN0.readMsgBuf(&CANrxId, &CANlen, CANrxBuf); // Read data: len = data length, buf = data byte(s)
- Serial.print("#5555CAN_READ read ID: ");
- Serial.print(CANrxId, HEX);
- Serial.print(" Data: [");Serial.print(CANlen); Serial.print("]");
-
-
- if(CANlen == CAN_MSG_DATA8_LEN) {
-
- DISPLAY__print_loop(DISPLAY_CURSOR_Y_CHARS_CAN_DEBUG, "CAN RECV DATA", 13, DISPLAY__print_loop_ACTION_ADD ) ;
-
- } //if(CANlen == CAN_MSG_DATA8_LEN) {
-
- for(int i = 0; i<CANlen; i++) // Print each byte of the data
- {
- if(CANrxBuf[i] < 0x10) // If data byte is less than 0x10, add a leading zero
- {
- Serial.print("0");
-
- }
- Serial.print(CANrxBuf[i], HEX);
- Serial.print(" ");
-
-
- }
- Serial.println();
-
-
- // else Serial.println(" [CAN] [NOT][digitalRead(CAN_INTpin)] ");
-
- }
- }
|