CAN (CANbus)

CANChannel

CANChannel

Create a CANChannel global object to connect to a CAN bus on the specified pins.

// SYNTAX
CANChannel can(pins, rxQueueSize, txQueueSize);

Parameters:

  • pins: the Photon and Electron support pins CAN_D1_D2, and the Electron only, supports pins CAN_C4_C5
  • rxQueueSize (optional): the receive queue size (default 32 message)
  • txQueueSize (optional): the transmit queue size (default 32 message)
// EXAMPLE
CANChannel can(CAN_D1_D2);
// Buffer 10 received messages and 5 transmitted messages
CANChannel can(CAN_D1_D2, 10, 5);