#include
#include
const int SPI_CS_PIN = 10;
MCP_CAN CAN(SPI_CS_PIN);
void setup() {
Serial.begin(115200);
while (CAN_OK != CAN.begin(CAN_500KBPS)) {
Serial.println("CAN BUS Shield init fail");
delay(100);
}
Serial.println("CAN BUS Shield init ok!");
}
void loop() {
unsigned char message[8] = {'H', 'e', 'l', 'l', 'o', ' ', '!', ' '};
CAN.sendMsgBuf(0x00, 0, 8, message);
Serial.println("Message sent: Hello !");
delay(1000); // Send message every second
}