Created
August 23, 2018 10:26
-
-
Save elktros/d7a64f7becc6b067e2d0dcb145392acf to your computer and use it in GitHub Desktop.
Transmitter code for Interfacing MCP2515 CAN Module with Arduino.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); | |
} |
I am getting the same error as well
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am doing same but i got an error (exit status 1
mcp_can.h: No such file or directory) like this. I have downloaded the libraries of MCP_CAN 2515 related but still same error is coming. I am using arduino 1.8.1 version and the board is arduino mega 2560. please look at above code and where i am doing mistake please give me replay .