TB6612.py 文件源码

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

项目:SunFounder_PiCar 作者: sunfounder 项目源码 文件源码
def __init__(self, direction_channel, pwm=None, offset=True):
        '''Init a motor on giving dir. channel and PWM channel.'''
        if self._DEBUG:
            print self._DEBUG_INFO, "Debug on"
        self.direction_channel = direction_channel
        self._pwm = pwm
        self._offset = offset
        self.forward_offset = self._offset

        self.backward_offset = not self.forward_offset
        self._speed = 0

        GPIO.setwarnings(False)
        GPIO.setmode(GPIO.BCM)

        if self._DEBUG:
            print self._DEBUG_INFO, 'setup motor direction channel at', direction_channel
            print self._DEBUG_INFO, 'setup motor pwm channel as', self._pwm.__name__
        GPIO.setup(self.direction_channel, GPIO.OUT)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号