跳转到主要内容

Python网络桥接CAN

项目描述

为使用python-can创建一个TCP/IP桥接CAN。

安装

使用pip安装

$ pip install python-can-remote

使用方法

从命令行启动服务器

$ python -m can_remote --interface=virtual --channel=0 --bitrate=500000

创建python-can总线

import can

# Create a connection to server. Any config is passed to server.
bus = can.Bus('ws://localhost:54701/',
              bustype='remote',
              bitrate=500000,
              receive_own_messages=True)

# Send messages
msg = can.Message(arbitration_id=0x12345, data=[1,2,3,4,5,6,7,8])
bus.send(msg)

# Receive messages
msg2 = bus.recv(1)
print(msg2)

# Disconnect
bus.shutdown()

网络界面

还有一个基本的网络界面,可以通过浏览器检查CAN流量。它可以在同一地址上通过HTTP访问,例如 http://localhost:54701/

项目详情


下载文件

下载适合您平台的应用程序。如果您不确定选择哪个,请了解有关安装软件包的更多信息。

源分布

python_can_remote-0.2.2.tar.gz (192.5 kB 查看哈希值)

上传时间

构建分布

python_can_remote-0.2.2-py3-none-any.whl (190.3 kB 查看哈希值)

上传时间 Python 3

由以下支持