def setup_output(self, name, pwm=False, initial=False):
""" Set pin as output.
:param name: Numer of the pin.
:type name: int
:param pwm: If value if PWM.
:type pwm: bool
:param initial: Initial value to set.
:type initial: bool
"""
self._pins[name] = {"name": name, "type": "out", "pwm": None}
GPIO.setup(name, GPIO.OUT)
if pwm:
pwm = GPIO.PWM(name, 200)
pwm.start(initial * 100.0)
self._pins[name]["pwm"] = pwm
else:
self[name] = initial
评论列表
文章目录