CAN (CANbus)

receive()

CAN::receive, receive, CAN.receive

Take a received message from the receive queue. This function does not wait for a message to arrive.

// SYNTAX
can.receive(message);

Parameters:

  • message: where the received message will be copied

Returns: boolean true if a message was received, false if the receive queue was empty.

// EXAMPLE
CANChannel can(CAN_D1_D2);
CANMessage message;
if(can.receive(message)) {
  Log.info("id=%lu len=%u", message.id, message.len);
}