Guest User

Untitled

a guest
Sep 17th, 2013
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import RPi.GPIO as GPIO
  2. import Tkinter
  3. GPIO.setup(7,GPIO.OUT)
  4. from Tkinter import *
  5. root = Tk()
  6.  
  7. def Off(event):
  8.     GPIO.output(7,False)
  9.  
  10. def On(event):
  11.     GPIO.output(7,True)
  12.    
  13. btn1 = Button(root,
  14.                 text="On",
  15.                 width=30,height=5,
  16.                 bg="white",fg="black")
  17. btn1.bind("<Button-1>", On)
  18. btn1.pack()
  19.  
  20. btn2 = Button(root,
  21.                 text="Off",
  22.                 width=30,height=5,
  23.                 bg="white",fg="black")
  24. btn2.bind("<Button-1>", Off)
  25. btn2.pack()            
  26. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment