check if msg received

This commit is contained in:
Sam Perry 2022-12-23 13:20:26 -05:00
parent 579c15cc95
commit d9edd16d7a

View file

@ -11,17 +11,17 @@ void setup() {
void loop() {
twai_message_t rx_frame;
ESP32Can.CANReadFrame(&rx_frame);
if (ESP32CAN_OK == ESP32Can.CANReadFrame(&rx_frame)) { /* CAN message received*/
Serial.print(rx_frame.identifier, HEX);
Serial.print(" ");
Serial.print(rx_frame.data_length_code);
Serial.print(rx_frame.identifier, HEX);
Serial.print(" ");
Serial.print(rx_frame.data_length_code);
for (int i=0; i<rx_frame.data_length_code; i++) {
Serial.print(rx_frame.data[i], HEX);
}
for (int i=0; i<rx_frame.data_length_code; i++) {
Serial.print(rx_frame.data[i], HEX);
Serial.println();
}
Serial.println();
delay(1000);
}