I am trying to communicate between Raspberry Pi and Arduino. In arduino I am using this program to transmit
#include <SPI.h>
#include <mcp_can.h>
const int spiCSPin = 10;
MCP_CAN CAN(spiCSPin);
void setup()
{
Serial.begin(115200);
while (CAN_OK != CAN.begin(CAN_125KBPS))
{
Serial.println("CAN BUS init Failed");
delay(100);
}
Serial.println("CAN BUS Shield Init OK!");
}
unsigned char stmp[8] = {1, 2, 3, 4, 5, 6, 7, 8};
void loop()
{
Serial.println("In loop");
CAN.sendMsgBuf(0x43, 0, 8, stmp);
delay(1000);
}
In Raspberry pi I am using this program to recieve
import can
import time
can_interface = 'can0'
bus = can.interface.Bus(can_interface,bustype='socketcan'
while True:
message = bus.recv()
print(message)
time.sleep(1)
All I get is
Timestamp: 1607187085.129426 ID: 0020 S DLC: 8 00 19 00 01 03 01 04 01 Channel: can0
everytime What should I do to recieve values I sent from arduino to Raspberry pi Thank you