from gadgets.th_gpio import TH_GPIO
import time 


class LED():
	def __init__(self,gpio_number=7):
		self.gpio_number = gpio_number
		#A singleton class is treated like a function
		TH_GPIO().enable_pin(gpio_number,mode='out')
    
	def on(self):
		TH_GPIO().send(self.gpio_number,1)
    
	def off(self):
		TH_GPIO().send(self.gpio_number,0)
    
	def blink(self,numTimes=3,speed=1):
		for i in range(0,numTimes):## Run loop numTimes
			TH_GPIO().send(self.gpio_number,1)
			time.sleep(speed)## Wait
			TH_GPIO().send(self.gpio_number,0)
			time.sleep(speed)## Wait
      
	def cleanup(self):
		TH_GPIO().disable_pin(self.gpio_number)

      

@@ -559,22 +559,22 @@
 ## Wait%0A
-      
+%0A%09%09%09%09%0A
 %0A%09def cl
@@ -632,12 +632,657 @@
 er)%0A
-%0A      
+%09%09%0Aclass PWM_LED():%0A%09def __init__(self,gpio_number=7,freq=100):%0A%09%09self.gpio_number = gpio_number%0A%09%09self.freq = freq%0A%09%09self.pwm = TH_GPIO().pwm_create(self.gpio_number,freq=self.freq)%0A    %0A%09def set_freq(self,freq):%0A%09%09self.freq = freq%0A%09%09self.pwm.set_freq(freq)%0A%09%0A%09def dim(self,start=100,end=0,step=-1,dur=0.1):%0A%09%09if self.pwm is not None:%09%09%09%0A%09%09%09for dc in range(start,end, step):%0A%09%09%09%09self.pwm.change(dc)%0A%09%09%09%09time.sleep(dur)%0A%0A%09def brighten(self,start=0,end=100,step=1,dur=0.1):%0A%09%09if self.pwm is not None:%09%09%09%0A%09%09%09for dc in range(start,end, step):%0A%09%09%09%09self.pwm.change(dc)%0A%09%09%09%09time.sleep(dur)%09%09%09%09%0A%0A%09def cleanup(self):%0A%09%09TH_GPIO().disable_pin(self.gpio_number)%09%09
 %0A

Update led.py