Created
August 31, 2015 13:54
-
-
Save joffilyfe/5282daa04a9f994dc3b2 to your computer and use it in GitHub Desktop.
Interface para enviar comandos ao Arduino com Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Tkinter import * | |
import base64 | |
import serial | |
class Main: | |
def __init__(self, master): | |
self.frame = Frame(master) | |
self.frame.pack() | |
self.ser = serial.Serial('/dev/tty.usbmodem1411', 9600) | |
self.grupo = LabelFrame(self.frame, text="Enviando comandos para o Arduino") | |
self.grupo.pack() | |
# self.text = Text(self.grupo) | |
# self.text.pack() | |
self.botao_oito = Button(self.grupo, text="Pisca o 8", width=20, command=self.blink_8) | |
self.botao_nove = Button(self.grupo, text="Pisca o 9", width=20, command=self.blink_9) | |
self.botao_oito.pack(side=LEFT) | |
self.botao_nove.pack(side=RIGHT) | |
def blink_8(self): | |
self.ser.write('8') | |
def blink_9(self): | |
self.ser.write('9') | |
root = Tk() | |
Main(root) | |
root.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment