如何使用Python-Can和Raspberry过滤canBus for ID的结果

问题描述 投票:0回答:1

您好,我有一个带有MCP2515 canBus设备的Raspberry,用于读取广播的整个值,它只是使用python-can在Python中的这个源:

import can 
bus = can.interface.Bus(channel='can0', bustype='socketcan_native') 
notifier = can.Notifier(bus, [can.Printer()])

我需要过滤id的结果,它是如何工作的?任何人都可以举例说明是否可以制作过滤器?我在图书馆的网站上观看,这是过滤的网页:https://python-can.readthedocs.io/en/stable/bus.html#filtering

它是如何工作的?非常感谢你的回复。

python python-3.x raspberry-pi can-bus
1个回答
0
投票

我认为这意味着什么

def on_message_received:
    set_filters(can_filters{"can_id": 0x11, "can_mask": 0x21})

另一个参考[​​Json] https://github.com/normaldotcom/CANard/blob/master/examples/example_db.json

© www.soinside.com 2019 - 2024. All rights reserved.