Untitled
unknown
plain_text
a year ago
618 B
19
Indexable
import os
import can
# Initialize the virtual CAN interface
bus = can.interface.Bus(channel='vcan0', bustype='socketcan')
log_file_path = "/mnt/data/23S3P Battery trial.log"
# Open the log file and send data line by line
with open(log_file_path, 'r') as log_file:
for line in log_file:
# Convert the log line to a byte array (8 bytes max for CAN frame)
data = line.strip().encode()[:8]
# Create a CAN message
msg = can.Message(arbitration_id=0x123, data=data, is_extended_id=False)
# Send the message
bus.send(msg)
print(f"Sent: {msg}")
Editor is loading...
Leave a Comment