From d9edd16d7a2cc8fa19ff50377f051d69be38fc70 Mon Sep 17 00:00:00 2001 From: Sam Perry <17242713+sdp8483@users.noreply.github.com> Date: Fri, 23 Dec 2022 13:20:26 -0500 Subject: [PATCH] check if msg received --- examples/esp32can_receive/esp32can_receive.ino | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/esp32can_receive/esp32can_receive.ino b/examples/esp32can_receive/esp32can_receive.ino index a8538f9..d533ee8 100644 --- a/examples/esp32can_receive/esp32can_receive.ino +++ b/examples/esp32can_receive/esp32can_receive.ino @@ -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); + + for (int i=0; i