I downloaded the zip from a website made by Cory J Fowler and then used the examples “send” Adruino sketch that is provided in the zip folder i downloaded:
"// demo: CAN-BUS Shield, send data
#include <mcp_can.h>
#include <SPI.h>
MCP_CAN CAN0(9); // Set CS to pin 9
void setup()
{
Serial.begin(115200);
// init can bus, baudrate: 500k
if(CAN0.begin(CAN_500KBPS) == CAN_OK) Serial.print(“can init ok!!\r\n”);
else Serial.print(“Can init fail!!\r\n”);
}
unsigned char stmp[8] = {0, 1, 2, 3, 4, 5, 6, 7};
void loop()
{
// send data: id = 0x00, standrad flame, data len = 8, stmp: data buf
CAN0.sendMsgBuf(0x00, 0, 8, stmp);
delay(100); // send data per 100ms
}
/*********************************************************************************************************
END FILE
*********************************************************************************************************/"
I also attached the file of this sketch. As you can see i changed line 4 “MCP_CAN CAN0(10);” to “MCP_CAN CAN0(9);” because I’m using a later version of Adruino and it’s my understanding that i must do that because i have a later version of adruino and a MEGA 2560 board attached to a CAN-BUS Shield (properly). The problem I’m having is that the sketch compiles and downloads to the bopard successfully but when i pull up the serial monitor i seem to always be getting “Can init fail!!\r\n”. Are there any strategies to fixing this problem. PLEASE HELP.
Additional Information:
I’m using a CAM-BUS Shield made by ElecFreaks, it comes right up if you google it (i can’t provide the link because it thinks I’m trying to spam this site).
I’m using the CAM BUS Shield m
Also i have nothing connected to pin 10. I do have the CAN BUS Shield hooked up to a NEO VI FIRE via CANH and CANL pins. (not sure if that matters but ultimately my goal is to get a mega 2560 board with a CAN BUS Shield to communicate with the NEO VI FIRE) I’m very new to this stuff so any kind of information what-so-ever would be greatly appreciated.