Skip to content

Instantly share code, notes, and snippets.

@aula9
Last active December 3, 2018 15:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aula9/2eaef5aac703a9ee4bf55260e45a1360 to your computer and use it in GitHub Desktop.
Save aula9/2eaef5aac703a9ee4bf55260e45a1360 to your computer and use it in GitHub Desktop.
from tkinter import *
import time
import RPi.GPIO as io
io.setmode(io.BOARD)
io.setwarnings(False)
Top = Tk()
io.setup(11,io.OUT)
io.setup(15,io.OUT)
io.setup(13,io.OUT)
pr = io.PWM(11,50)
pr.start(5)
pg = io.PWM(15,50)
pg.start(5)
pb = io.PWM(13,50)
pb.start(5)
def updater1(dutyr):
pr.ChangeDutyCycle(float(dutyr))
print(dutyr)
def updater2(dutyg):
pg.ChangeDutyCycle(float(dutyg))
print(dutyg)
def updater3(dutyb):
pb.ChangeDutyCycle(float(dutyb))
print(dutyb)
w1 = Scale(Top ,from_=0,to =100,orient = HORIZONTAL ,length =500,tickinterval=5,command = updater1)
w1.set(5)
w1.pack()
w2 = Scale(Top ,from_=0,to =100,orient = HORIZONTAL,length =500,tickinterval=5,command = updater2)
w2.set(5)
w2.pack()
w3 = Scale(Top ,from_=0,to =100,orient = HORIZONTAL,length =500,tickinterval=5,command = updater3)
w3.set(5)
w3.pack()
mainloop()
@aula9
Copy link
Author

aula9 commented Jul 16, 2018

@aula9
Copy link
Author

aula9 commented Jul 16, 2018

Work on both Python 2 (from Tkinter import *) and 3 (from tkinter import * ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment