Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO
- import Tkinter
- GPIO.setup(7,GPIO.OUT)
- from Tkinter import *
- root = Tk()
- def Off(event):
- GPIO.output(7,False)
- def On(event):
- GPIO.output(7,True)
- btn1 = Button(root,
- text="On",
- width=30,height=5,
- bg="white",fg="black")
- btn1.bind("<Button-1>", On)
- btn1.pack()
- btn2 = Button(root,
- text="Off",
- width=30,height=5,
- bg="white",fg="black")
- btn2.bind("<Button-1>", Off)
- btn2.pack()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment