|

楼主 |
发表于 2018-5-7 13:04:12
|
显示全部楼层
原理我懂,我就是不知道那个计数的量怎么设定
def ledon():
led()
x = 1
while(1):
GPIO.output(7,GPIO.HIGH)
#time.sleep(2)
GPIO.cleanup()
def ledoff():
led()
GPIO.output(7,GPIO.LOW)
led()
GPIO.output(7,GPIO.LOW)
GPIO.cleanup()
def kongzhi():
master = Tk()
master.title("CONTROL")
width,height=420,200#窗口大小
master.geometry('%dx%d+%d+%d'%(width,height,(master.winfo_screenwidth() - width ) / 2, (master.winfo_screenheight() - height) / 2))#居中
a = Button(master,text = "go",bg="yellow",fg="red",command =qianjin,width=2,height=1)
a.grid(row=1,column=6,padx=10,pady=15)
b = Button(master,text = "back",bg="yellow",fg="red",command = houtui,width=2,height=1)
b.grid(row=5,column=6,padx=10,pady=15)
c = Button(master,text = "left",bg="yellow",fg="red",command = xiangyou,width=2,height=1)
c.grid(row=3,column=4,padx=10,pady=15)
d = Button(master,text = "righe",bg="yellow",fg="red",command = xiangzuo,width=2,height=1)
d.grid(row=3,column=8,padx=10,pady=15)
e = Button(master,text = "ledon",bg="yellow",fg="red",repeatdelay=0,repeatinterval=100,command = ledon,width=4,height=1)
e.grid(row=1,column=12,padx=70,pady=15)
f = Button(master,text = "ledoff",bg="yellow",fg="red",command = ledoff,width=4,height=1)##repeatdelay=0,repeatinterval=100,
f.grid(row=5,column=12,padx=70,pady=15)
mainloop()
这个是那一部分我写的程序 |
|