#include <SPI.h>#include <mcp_can.h>
const int spiCSPin = 10;int ledHIGH = 1;int ledLOW = 0;
MCP_CAN CAN(spiCSPin);
void setup(){ Serial.begin(115200);
while (CAN_OK != CAN.begin(CAN_500KBPS)) { Serial.println("CAN BUS init Failed"); delay(100); } Serial.println("CAN BUS Shield Init OK!");}
unsigned char stmp[8] = {ledHIGH, 1, 2, 3, ledLOW, 5, 6, 7}; void loop(){ Serial.println("In loop"); CAN.sendMsgBuf(0x43, 0, 8, stmp); delay(1000);}
Hi,
I was trying to compile this code. However, I am receiving an error message "cannot declare variable 'CAN' to be of abstract type".
I have downloaded the concerned library for mcp_can.
I have referred this website for this code Arduino MCP2515 CAN Bus Interface Tutorial - CAN Protocol
Kindly help us resolving this issue.