Hello ,
I have start to work on a small canbus project
which I need to read the data
I have this :
I did this
but its very crooked , and if I will get another pid size
****
and another question :
I can't seem to get the data : 0a bc 0d 04 05 06 cc 1f
I have try this , but I get error
Thanks ,
I have start to work on a small canbus project
which I need to read the data
I have this :
while True: message = bus.recv() print (message) PID = str(message.arbitration_id) dlc= message.dlc print ('PID is - ' + str(PID)) Data = message.data print(Data)and this is result I'm getting
Timestamp: 1608032877.333082 ID: 0eddcc08 X DLC: 8 0a bc 0d 04 05 06 cc 1f Channel: can0 PID is - 249416712I need\want it to save the HEX value (0eddcc08) an not convert it to int
I did this
message_str = str(bus.recv()) print (message_str) n = message_str.find("ID: ") end = message_str.find("X") pid = message_str[n + 4:int(end)] print (pid)and I get the wanted answer
but its very crooked , and if I will get another pid size
****
and another question :
I can't seem to get the data : 0a bc 0d 04 05 06 cc 1f
I have try this , but I get error
File "Documents/Read_Canbus.py", line 30, in <module> data - message.data NameError: name 'data' is not definedbut when I look at the API
https://python-can.readthedocs.io/en/stable/message.htmlI undersatnd there is such object called message.data , no ?
Thanks ,