def _setup_pin(self, pin):
self._logger.debug(u"_setup_pin(%s)" % (pin,))
if pin:
p = None
if self._pigpiod is None:
self._pigpiod = pigpio.pi()
if self._settings.get_boolean(['pigpiod']):
if not self._pigpiod.connected:
self._logger.error(u"Unable to communicate with PiGPIOd")
else:
p = PiGPIOpin(self._pigpiod, pin, self._logger)
else:
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(pin, GPIO.OUT)
GPIO.output(pin, GPIO.HIGH)
p = GPIO.PWM(pin, 100)
p.start(100)
return p
评论列表
文章目录