Arduino Program The Arduino program you provided is almost complete. It sends CAN messages with incrementing IDs from 0 to 2047. Below is the complete Arduino code: #include #include struct can_frame canMsg1; MCP2515 mcp2515(10); uint16_t licznik = 0; void setup() { canMsg1.can_dlc = 8; for (int i = 0; i < 8; i++) { canMsg1.data[i] = 0xAA; } while (!Serial); Serial.begin(115200); mcp2515.reset(); mcp2515.setBitrate(CAN_500KBPS); mcp2515.setNormalMode(); Serial.println("Example: Write to CAN"); } void loop() { canMsg1.can_id = licznik; mcp2515.sendMessage(&canMsg1); Serial.print("dziesiętna wartość adresu: "); Serial.println(licznik); licznik++; if (licznik > 2047) { licznik = 0; } delay(10); } Python Program with GUI Below is a Python program using the tkinter library for the GUI and python-can for CAN communication. This program allows you to input bytes and send them to the specified CAN address. import tkinter as tk from tkinter import messagebox import can class CANScannerApp: def __init__(self, root): self.root = root self.root.title("CAN Scanner") self.label = tk.Label(root, text="Enter CAN Address (0-2047):") self.label.pack() self.address_entry = tk.Entry(root) self.address_entry.pack() self.data_labels = [] self.data_entries = [] for i in range(8): label = tk.Label(root, text=f"Byte {i}:") label.pack() self.data_labels.append(label) entry = tk.Entry(root) entry.pack() self.data_entries.append(entry) self.send_button = tk.Button(root, text="Send", command=self.send_message) self.send_button.pack() self.bus = can.interface.Bus(channel='can0', bustype='socketcan') def send_message(self): try: address = int(self.address_entry.get()) if address < 0 or address > 2047: raise ValueError("Address out of range") data = [] for entry in self.data_entries: byte = int(entry.get(), 16) if byte < 0 or byte > 255: raise ValueError("Byte out of range") data.append(byte) msg = can.Message(arbitration_id=address, data=data, is_extended_id=False) self.bus.send(msg) messagebox.showinfo("Success", "Message sent successfully") except ValueError as e: messagebox.showerror("Error", str(e)) except can.CanError: messagebox.showerror("Error", "Failed to send message") if __name__ == "__main__": root = tk.Tk() app = CANScannerApp(root) root.mainloop() Instructions 1 Arduino: Upload the provided Arduino code to your Arduino board. 2 Python: Install the required Python libraries using pip: pip install python-can 3 Run the Python GUI: Execute the Python script to open the GUI, input the CAN address and data bytes, and send the message. This setup allows you to scan and send CAN messages from address 0 to 2047 with specified data bytes.