コード例 #1
0
def just_go_backward(speed):

    # set left motor to go backward by GPIO and motor_module
    setup.motor(setup.backward0, setup.Motor_Left_A, setup.Motor_Left_B)
    GPIO.output(setup.Motor_Left_PWM, GPIO.HIGH)

    # set right motor to go backward by GPIO and motor_module
    setup.motor(setup.backward1, setup.Motor_Right_A, setup.Motor_Right_B)
    GPIO.output(setup.Motor_Right_PWM, GPIO.HIGH)

    # set left and right Pwm to get speed
    setup.Left_Pwm.ChangeDutyCycle(speed)
    setup.Right_Pwm.ChangeDutyCycle(speed)
コード例 #2
0
def left_PointTurn(speed, running_time):

    # set the left motor and pwm to go backward
    setup.motor(setup.bakward0, setup.Motor_Left_A, setup.Motor_Left_B)
    GPIO.output(setup.Motor_Left_PWM, GPIO.LOW)

    # set the right motor and pwm to go forward
    setup.motor(setup.forward1, setup.Motor_Right_A, setup.Motor_Right_B)
    GPIO.output(setup.Motor_Right_PWM, GPIO.HIGH)

    # set the speed of the left and right motor to go
    setup.Left_Pwm.ChangeDutyCycle(speed)
    setup.Right_Pwm.ChangeDutyCycle(speed)

    # set the running time of the left and right motor
    time.sleep(running_time)
コード例 #3
0
def left_SwingTurn(speed, running_time):

    # set the left motor pwm to stop = turn off
    GPIO.output(setup.Motor_Left_PWM, GPIO.LOW)

    # set the right motor and pwm to go forward
    setup.motor(setup.forward0, setup.Motor_Right_A, setup.Motor_Right_B)
    GPIO.output(setup.Motor_Right_PWM, GPIO.HIGH)

    # set the speed of the left motor to stop
    setup.Left_Pwm.ChangeDutyCycle(0)
    # set the spedd of the right motor to go forward
    setup.Right_Pwm.ChangeDutyCycle(speed)

    # set the running tiem of the right motor to go forward
    time.sleep(running_time)
コード例 #4
0
def go_backward(speed, running_time):

    # set left motor to go backward by GPIO and motor_module
    setup.motor(setup.backward0, setup.Motor_Left_A, setup.Motor_Left_B)
    GPIO.output(setup.Motor_Left_PWM, GPIO.HIGH)

    # set right motor to go backward by GPIO and motor_module
    setup.motor(setup.backward1, setup.Motor_Right_A, setup.Motor_Right_B)
    GPIO.output(setup.Motor_Right_PWM, GPIO.HIGH)

    # set left and right Pwm to get speed
    setup.Left_Pwm.ChangeDutyCycle(speed)
    setup.Right_Pwm.ChangeDutyCycle(speed)

    # stop motor after running_time
    time.sleep(running_time)
    stop()