Beispiel #1
0
 def __init__(self, pin):
     """
     define an LED on a given pin
     :param pin: the number of the pin
     """
     pin = pin_id(pin)
     self.light = machine.PWM(machine.Pin(pin), freq=1000)
 def __init__(self, pin, minimum=40, maximum=115):
     """
     define an LED on a given pin
     :param pin: the number of the pin
     """
     pin = pin_id(pin)
     self.servo = machine.PWM(machine.Pin(pin), freq=50)
     self.minimum = minimum
     self.maximum = maximum
     self.middle = int((maximum - minimum) / 2) + minimum
Beispiel #3
0
 def __init__(self, pin, minimum=29, maximum=115):
     """
     define an LED on a given pin
     :param pin: the number of the pin
     """
     pin = pin_id(pin)
     self.servo = machine.PWM(machine.Pin(pin), freq=50)
     self.minimum = minimum
     self.maximum = maximum
     self.middle = int((maximum - minimum) / 2) + minimum
     self.servo.duty(self.middle)
     self.position = self.middle
     self.atdratio = 180 / (maximum - minimum)
     self.dtaratio = (maximum - minimum) / 180