Hello everyone , I meet you again , I'm your friend, Quan Jun .
Look up python-can file , Know the supporting part zhouligong CAN Interface card , So write routine verification data Sending of . in addition , The use of python Version is 3.4, In the installation python-can The prompt cannot be found windows-curses The installation package of the corresponding version , Therefore, in python-can Of setup.py in , To cancel the windows-curses The installation of depends on . The code is as follows (ControlCAN.dll To be placed in the same path ):
from __future__ import print_function
import platform
import can
def send_one():
bus = can.interface.Bus(bustype='canalystii', channel=0, baud=500000)
msg = can.Message(arbitration_id=0xc0ffee,
data=[0, 25, 0, 1, 3, 1, 4, 1],
is_extended_id=True)
try:
bus.send(msg)
print("Message sent on {}".format(bus.channel_info))
except can.CanError:
print("Message NOT sent")
if __name__ == '__main__':
send_one()
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/151788.html Link to the original text :https://javaforall.cn
describe Wang Qiang is very h
With the increasing popularity