When I run my code without the shield mounted I get a 0 in return when I init the CanBus.
When I run my code with the shield mounted I get a 1 in return when I init the CanBus.
That seems to be right?
But I can not receive or send any thing. I don't know if it is the library or it is the shield thev is something wrong with?
The timeout in the send function, is it how long time it will sending? Ex. 100ms?
In b4r I revieve a 0 when I try to connect with this code.
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public Serial1 As Serial
Public CanBus1 As MCP2515
B4X:
' The constants For the baud settings are:
' 1 = CAN_BAUD_10K
' 2 = CAN_BAUD_50K
' 3 = CAN_BAUD_100K
' 4 = CAN_BAUD_125K
' 5 = CAN_BAUD_250K
' 6 = CAN_BAUD_500K
'Is CanBus connected
Dim canbusConnected As Boolean
canbusConnected = CanBus1.InitCAN(6)
Log("CanBus Connected: ", canbusConnected)
// demo: CAN-BUS Shield, send data
// loovee@seeed.cc
#include <mcp_can.h>
#include <SPI.h>
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
const int SPI_CS_PIN = 9;
MCP_CAN CAN(SPI_CS_PIN); // Set CS pin
Maybe I need to set the SPI port? But I dont have that option?