Transmit data to remote CAN device. (This function is created referencing the CAN bus library from Seeed Studio, Depending on your preferences, you can use this function to transmit data instead of the beginTransmission() and write() functions.)


CAN.sendMsgBuf(id, ext, len, buf)


  • id: Device ID for the remote CAN device
  • ext: Data transmission format
    • CAN_STDID: Standard data frame, comply with CAN 2.0A standard. ID range: 0 ~ 0x7FF
    • CAN_EXTID: Extended data frame, based on CAN 2.0B standard. ID range: 0 ~ 0x1FFFFFFF
    • CAN_STDID_REMOTE: Standard data frame, comply with CAN 2.0A standard. ID range: 0 ~ 0x7FF
    • CAN_EXTID_REMOTE: Extended data frame, comply with CAN 2.0B standard. ID range: 0 ~ 0x1FFFFFF
  • len: size of the array
  • buf: data array


CAN_OK: Data transmitted
CAN_FAIL: Data transmission failed.


#include <CANBus.h>
unsigned char buf[8] = {0, 1, 2, 3, 4, 5, 6, 7};
void setup(){
void loop(){
    CAN.sendMsgBuf(0x00, CAN_STDID, 8, buf);   // Transmit data
                                               // Set remote CAN device ID to 0x00
                                               // Using standard data format
                                               //8 bytes of data
                                               // buf:  data array

See also

Libraries Reference Home

The text of the 86Duino reference is a modification of the Arduino reference and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

Leave a Comment

Your email address will not be published. Required fields are marked *