#!/usr/bin/python ################ # Port Detection import serial for com in range(0,4): try: PORT = '/dev/ttyACM'+str(com) BAUD = 9600 board = serial.Serial(PORT,BAUD) board.close() break except: pass ######## # Blinks from Tkinter import * import time DEVICE = '/dev/ttyACM'+str(com) BAUD = 9600 ser = serial.Serial(DEVICE, BAUD) root = Tk() def five() : ser.write('5') return def two() : ser.write('2') return def seven() : ser.write('7') return root.title("Trying Arduino") Label(text="Linux Magazine: Raspberry Pi Special", fg="#0A116B").pack() Label(text="Raspberry Pi says: Hello Arduino!",fg="#0A116B").pack() Button(text='2 blinks', command=two, background="#33D63B", fg="#FFFFFF").pack() Button(text='5 blinks', command=five, background="#1DE4F2", fg="#FFFFFF").pack() Button(text='7 blinks', command=seven, background="#DC0F16", fg="#FFFFFF").pack() root.mainloop()