__init__.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:OctoPrint-LEDStripControl 作者: google 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号