The script works flawlessly, but when I am above roughly 40% of full speed, the fans will speed up (audibly) to 90ish%. If I move the slider down, the fans stay at the same speed. However if I adjust to full, speed and then back down... the fans will slow. If I stay under 40% speed.... this does not happen. Also, moving the slider slowly between 0-1023 produces good results and accurate control.
Am I missing anything obvious? How can I find out what is changing my value?
Code: Select all
from Tkinter import *
import wiringpi2 as wiringpi
import opc, time
# Set up wiringpi
wiringpi.wiringPiSetupGpio()
wiringpi.pinMode(18,2)
wiringpi.pwmSetClock(6)
wiringpi.pwmSetRange(1024)
def __init__(self, master):
frame = Frame(master)
frame.pack()
Label(frame, text='Fan').grid(row=0, column=1)
scaleFan = Scale(frame, from_=307, to=1023,
orient=HORIZONTAL, command=self.updateFan,
length=400, width=50)
scaleFan.grid(row=1, column=1)
def updateFan(self, duty):
wiringpi.pwmWrite(18, int(duty))
root = Tk()
root.wm_title('Drank Fan Control')
app = App(root)
root.geometry("800x480+0+0")
root.mainloop()