CAN_Library
CAN_Library copied to clipboard
How to instantiate lib for using two MCP2515 controllers?
I'd like use two MCP2515 controllers for filtering/gateway a midspeed CAN-Bus (125kbs). All your examples, and even the documentation did not mention this setup. All the examples did not explicit instantiate from a class, they just simple use "CAN.".
So i tried to do: CAN TOBUS(9);
but this gave me an error while compiling.
Also CANClass TOBUS(9);
did not work.
Even CAN_MCP2515 TOBUS(9);
failed.
What do i do wrong? Could you please provide an example for it?
The MCP2515 code wasn’t originally designed to utilize more than one controller. I don’t currently have an example, and I don’t think I have hardware to support that for testing.
I’ll take a look at the code to see if there is an easy modification I can make, but at the moment the support is for only a single MCP2515.
FWIW the MCP_CAN_lib does support two MCP's, see the example https://github.com/coryjfowler/MCP_CAN_lib/blob/master/examples/Dual_CAN/Dual_CAN.ino . Not sure how much of their code you used, though.