Hello! I’m trying to use the CAN-BUS shield to control some BLDC motors but I can’t get the motors to receive data. I’m using the template code provided at: https://wiki.seeedstudio.com/2-Channel-CAN-BUS-FD-Shield-for-Raspberry-Pi/
import time
import can
bustype = ‘socketcan_native’
channel = ‘can0’
def producer(id):
“”":param id: Spam the bus with messages including the data id."""
bus = can.interface.Bus(channel=channel, bustype=bustype)
for i in range(10):
msg = can.Message(arbitration_id=0x141, data=[0xA6, 0x00,0x02,0x02, 35999, 35999>>8,0x00,0x00], extended_id=False)
bus.send(msg)
# Issue #3: Need to keep running to ensure the writing threads stay alive. ?
time.sleep(1)
producer(10)
The motor I’m trying to run has an ID of 0x141 and some of the commands I wish to send in order to make the motor move are:
0xA6, 0x00,0x02,0x02, 35999, 35999>>8,0x00,0x00
I realize that the data input only takes up to 255 input and so I get an error.
How should I resolve this issue and is the code I’ve written even the right way to go about it?
Kindly from Simon. Thank you for your time.