Hello Everyone,
i am trying to use the CAN-Bus Shield, but i facing some issue in compiling.
Of course i follows step by step the on-line tutorial (CAN-BUS Shield V2.0 - Seeed Wiki), downloading the library from git-hub repository (GitHub - Seeed-Studio/Seeed_Arduino_CAN: Seeed Arduino CAN-BUS library - MCP2518FD&MCP2515&MCP2551).
My code is very basic. I report it in the following:
#include <SPI.h>
#include “mcp2515_can.h”
const int SPI_CS_PIN = 9;
const int CAN_INT_PIN = 2;
mcp2515_can CAN(SPI_CS_PIN);
void setup() {
SERIAL_PORT_MONITOR.begin(115200);
while(CAN_OK != CAN.begin(CAN_500KBPS)){
SERIAL_PORT_MONITOR.println(“Inizializzazione CAN - FALLITA!”);
delay(100); // ci riprova tra 100 [ms]
}
SERIAL_PORT_MONITOR.println(“Inizializzazione CAN - eseguita con SUCCESSO!”);
}
unsigned char stmp[8] = {1,2,3,4,5,6,7,8};
void loop() {
CAN.sendMsgBuf(0x100, 0, 8, stmp);
delay(100);
}
Error i face is the following:
C:\Users\paolo\Desktop\ArduinoCAN-Shield_TX\ArduinoCAN-Shield_TX.ino: In function ‘void loop()’:
ArduinoCAN-Shield_TX:21:37: error: no matching function for call to ‘mcp2515_can::sendMsgBuf(int, int, int, unsigned char [8])’
CAN.sendMsgBuf(0x100, 0, 8, stmp);
^
In file included from C:\Users\paolo\Desktop\ArduinoCAN-Shield_TX\ArduinoCAN-Shield_TX.ino:2:0:
C:\Users\paolo\OneDrive\Documenti\Arduino\libraries\Seeed_Arduino_CAN-master\src/mcp2515_can.h:93:18: note: candidate: virtual byte mcp2515_can::sendMsgBuf(byte, long unsigned int, byte, byte, byte, const volatile byte*)
virtual byte sendMsgBuf(byte status, unsigned long id, byte ext, byte rtrBit, byte len, volatile const byte *buf); // send message buf by using parsed buffer status
^~~~~~~~~~
C:\Users\paolo\OneDrive\Documenti\Arduino\libraries\Seeed_Arduino_CAN-master\src/mcp2515_can.h:93:18: note: candidate expects 6 arguments, 4 provided
C:\Users\paolo\OneDrive\Documenti\Arduino\libraries\Seeed_Arduino_CAN-master\src/mcp2515_can.h:94:18: note: candidate: virtual byte mcp2515_can::sendMsgBuf(long unsigned int, byte, byte, byte, const byte*, bool)
virtual byte sendMsgBuf(unsigned long id, byte ext, byte rtrBit, byte len, const byte *buf, bool wait_sent = true); // send buf
^~~~~~~~~~
C:\Users\paolo\OneDrive\Documenti\Arduino\libraries\Seeed_Arduino_CAN-master\src/mcp2515_can.h:94:18: note: candidate expects 6 arguments, 4 provided
exit status 1
no matching function for call to ‘mcp2515_can::sendMsgBuf(int, int, int, unsigned char [8])’
For what i understand, the problem is linked with the “sendMsgBuf()” method, which requires 6 input instead 4.
But in the example i found the usage of this function is always with 4 inputs.
It is strange because the receiving code instead have good behaviour.
Can you help me?
Thanks in advance!!
Bests,
Pierpaolo.