Uma incursão rápida em Python e Tkinter (uma library para aplicações GUI muito fácil de usar no modo Google-Copy-Paste) para poder comunicar com o SBrick a partir do meu laptop Ubuntu sem usar a linha de comando:
#!/usr/bin/env python from Tkinter import * from time import sleep from subprocess import call def quit(): global Window Window.destroy() return; def STOP(): call("gatttool -b 00:07:80:7F:28:E1 -i hci0 --char-write --handle=0x0025 --value=0002",shell=True) call("gatttool -b 00:07:80:7F:28:E1 -i hci0 --char-write --handle=0x0025 --value=0003",shell=True) return def NORTH(): time=scale.get() call("gatttool -b 00:07:80:7F:28:E1 -i hci0 --char-write --handle=0x0025 --value=010301FF",shell=True) call("gatttool -b 00:07:80:7F:28:E1 -i hci0 --char-write --handle=0x0025 --value=010200FF",shell=True) sleep(time) STOP() return def SOUTH(): time=scale.get() call("gatttool -b 00:07:80:7F:28:E1 -i hci0 --char-write --handle=0x0025 --value=010300FF",shell=True) call("gatttool -b 00:07:80:7F:28:E1 -i hci0 --char-write --handle=0x0025 --value=010201FF",shell=True) print("Backward") sleep(time) STOP() return def EAST(): time=scale.get() call("gatttool -b 00:07:80:7F:28:E1 -i hci0 --char-write --handle=0x0025 --value=010301FF",shell=True) call("gatttool -b 00:07:80:7F:28:E1 -i hci0 --char-write --handle=0x0025 --value=010201FF",shell=True) print("RIGHT") sleep(time) STOP() return def WEST(): time=scale.get() call("gatttool -b 00:07:80:7F:28:E1 -i hci0 --char-write --handle=0x0025 --value=010200FF",shell=True) call("gatttool -b 00:07:80:7F:28:E1 -i hci0 --char-write --handle=0x0025 --value=010300FF",shell=True) sleep(time) STOP() return Window = Tk() Window.title("SBrick Remote Control v0.1") B_North = Button(text = "N", command = NORTH) B_North.grid(row=0, column=1) B_West = Button(text = "W", command = WEST) B_West.grid(row=1, column=0) B_STOP = Button(text = "STOP", command = STOP) B_STOP.grid(row=1, column=1) B_East = Button(text = "E", command = EAST) B_East.grid(row=1, column=2) B_South = Button(text = "S", command = SOUTH) B_South.grid(row=2, column=1) scale = Scale(Window, from_=0.125, to=2.5, digits=3, resolution=0.125, orient=HORIZONTAL, length=250, label="Time") scale.grid(row=3,column=0,columnspan=3) B_QUIT = Button(text = "QUIT", command = quit) B_QUIT.grid(row=4, column=1, ) mainloop()