Sfoglia il codice sorgente

fix AttributeError: NoneType' object has no attribute 'ChangeDutyCycle

pull/220/head
Alexander Solncev 7 anni fa
parent
commit
510154b911
1 ha cambiato i file con 5 aggiunte e 5 eliminazioni
  1. +5
    -5
      modules/base_plugins/gpio_actor/__init__.py

+ 5
- 5
modules/base_plugins/gpio_actor/__init__.py Vedi File

@@ -44,16 +44,16 @@ class GPIOPWM(ActorBase):
def init(self):
GPIO.setup(int(self.gpio), GPIO.OUT)
GPIO.output(int(self.gpio), 0)
if self.frequency is None:
self.frequency = 0.5 # 2 sec

self.p = GPIO.PWM(int(self.gpio), float(self.frequency))


def on(self, power=None):
if power is not None:
self.power = int(power)

if self.frequency is None:
self.frequency = 0.5 # 2 sec

self.p = GPIO.PWM(int(self.gpio), float(self.frequency))
print "GPIO ON"
self.p.start(int(self.power))

def set_power(self, power):


Loading…
Annulla
Salva