Description
sendMsgBuf()
– puts a CAN message into the send buffer.
Syntax
MCAN0.sendMsgBuf( t_can_message ) ;
Parameters
CANMessage t_can_message – the CAN message object to be send (see CANMessage class)
Returns
uint8_t:
CAN_OK – OK. Message could be placed into the send buffer
CAN_CTRLERROR – CAN bus error. Bus could not be activated (e.g. bus-off state)
CAN_FAILTX – Error putting the message into the tx buffer.
Example Code
The following example sends messages on CAN bus MCAN0.
void setup()
{
}
void loop ()
{
CANMessage myMsg;
myMsg.id = 0x12345;
myMsg.ext = true;
myMsg.len = 1;
myMsg.data[0] = 0xA5;
MCAN0.sendMsgBuf(myMsg);
delay(100);
}
Notes and Warnings
Examples can be found in the Arduino IDE menu:
File -> Examples -> DICE -> CAN Bus ->
See also
Find more details about the ‘bootloader settings’ and the CAN bus of dice devices
begin()
defines
CAN operation background
users manual
BOOTLOADER SETTINGS – Library