beebot.py 文件源码

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

项目:ropi 作者: ThumbGen 项目源码 文件源码
def initGPIO():
    global p, q, a, b
    #use physical pin numbering
    GPIO.setmode(GPIO.BOARD)

    #set up digital line detectors as inputs
    GPIO.setup(lineRight, GPIO.IN) # Right line sensor
    GPIO.setup(lineLeft, GPIO.IN) # Left line sensor

    #use pwm on inputs so motors don't go too fast
    GPIO.setup(L1, GPIO.OUT)
    p = GPIO.PWM(L1, 20)
    p.start(0)

    GPIO.setup(L2, GPIO.OUT)
    q = GPIO.PWM(L2, 20)
    q.start(0)

    GPIO.setup(R1, GPIO.OUT)
    a = GPIO.PWM(R1, 20)
    a.start(0)

    GPIO.setup(R2, GPIO.OUT)
    b = GPIO.PWM(R2, 20)
    b.start(0)

    threadC = threading.Thread(target=wheelCount)
    threadC.start()

# spinLeft(speed): Sets motors to turn opposite directions at speed. 0 <= speed <= 100
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号