22 lines
505 B
Python
22 lines
505 B
Python
import time
|
|
import can
|
|
|
|
bustype = "socketcan"
|
|
channel = "can0" # echten can nutzen
|
|
|
|
|
|
def producer(id):
|
|
""":param id: Spam the bus with messages including the data id."""
|
|
bus = can.Bus(channel=channel, interface=bustype)
|
|
for i in range(10):
|
|
msg = can.Message(
|
|
arbitration_id=0x002, data=[id, i, 0, 1, 3, 1, 4, 1], is_extended_id=False
|
|
)
|
|
bus.send(msg)
|
|
|
|
time.sleep(1)
|
|
|
|
|
|
producer(10) # rausfinden welche id der Slave hat
|
|
print("I am done with this shit")
|