home page 1
Moving on
Using the number input to choose the light to be turned on
All I have done is connect 2 more LED's - so pin 11, is Green, 12 is Yellow and 13 is Red
from Tkinter import *
root = Tk()
root.withdraw()
import tkSimpleDialog
number = tkSimpleDialog.askinteger("Which Light? ", "Enter 11, 12 or 13 ")
print (number)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(number, GPIO.OUT)
GPIO.output(number,True)
time.sleep(10)
GPIO.output(number,False)
when run this asks you for a number
11 gives Green, 12 gives yellow and 13 Red.
simple but works.
*****************