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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am getting the same error as well