Beispiel #1
0
def left_turn(speed, running_time):

    setup.rightmotor(setup.forward0)
    GPIO.output(setup.Motor_Right_PWM, GPIO.HIGH)
    GPIO.output(setup.Motor_Left_PWM, GPIO.LOW)
    setup.Right_Pwm.ChangeDutyCycle(speed)
    setup.Left_Pwm.ChangeDutyCycle(0)
    time.sleep(running_time)
Beispiel #2
0
def go_forward(speed):
''' move forward
    speed is motor move speed(0~100)'''
    # set left and right motor to move forward
    setup.leftmotor(setup.forward0)
    setup.rightmotor(setup.forward0)
    # set speed of motors to move forward
    setup.Left_Pwm.ChangeDutyCycle(speed)
    setup.Right_Pwm.ChangeDutyCycle(speed)
Beispiel #3
0
def go_forward_any(speed):

    setup.leftmotor(setup.forward0)
    GPIO.output(setup.Motor_Left_PWM, GPIO.HIGH)

    setup.rightmotor(setup.forward0)
    GPIO.output(setup.Motor_Right_PWM, GPIO.HIGH)

    setup.Left_Pwm.ChangeDutyCycle(speed)
    setup.Right_Pwm.ChangeDutyCycle(speed)
Beispiel #4
0
def go_forward_any(speed):

    setup.leftmotor(forward0)
    GPIO.output(MotorLeft_PWM, GPIO.HIGH)

    setup.rightmotor(forward0)
    GPIO.output(MotorRight_PWM, GPIO.HIGH)

    LeftPwm.ChangeDutyCycle(speed)
    RightPwm.ChangeDutyCycle(speed)
Beispiel #5
0
def go_forward(speed, running_time):

    setup.leftmotor(setup.forward0)
    GPIO.output(setup.Motor_Left_PWM, GPIO.HIGH)

    setup.rightmotor(setup.forward0)
    GPIO.output(setup.Motor_Right_PWM, GPIO.HIGH)

    setup.Left_Pwm.ChangeDutyCycle(speed)
    setup.Right_Pwm.ChangeDutyCycle(speed)

    time.sleep(running_time)
    stop()
Beispiel #6
0
def go_forward(speed, running_time):

    setup.leftmotor(forward0)
    GPIO.output(MotorLeft_PWM, GPIO.HIGH)

    setup.rightmotor(forward0)
    GPIO.output(MotorRight_PWM, GPIO.HIGH)

    LeftPwm.ChangeDutyCycle(speed)
    RightPwm.ChangeDutyCycle(speed)

    time.sleep(running_time)
    stop()
Beispiel #7
0
def rightRoundTurn(speed_high, speed_low):

    setup.rightmotor(setup.forward0)

    setup.leftmotor(setup.forward0)

    GPIO.output(setup.Motor_Left_PWM,GPIO.HIGH)

    GPIO.output(setup.Motor_Right_PWM,GPIO.HIGH)


    setup.Left_Pwm.ChangeDutyCycle(speed_low)

    setup.Right_Pwm.ChangeDutyCycle(speed_high)
Beispiel #8
0
def right_turn2(speed, running_time):
'''Move the left wheel forward and Turn the right wheel backward to right turn
   speed is turn speed
   running_time is the time the wheels move'''

    # set the left motor and pwm to move forward 
    setup.leftmotor(setup.forward0)
    GPIO.output(setup.Motor_Left_PWM,GPIO.HIGH)
    # set the right motor and pwm to move backward
    setup.rightmotor(setup.backward0)
    GPIO.output(setup.Motor_Right_PWM,GPIO.LOW)
    # set the speed of the left and right motor
    setup.Left_Pwm.ChangeDutyCycle(speed)
    setup.Right_Pwm.ChangeDutyCycle(speed)
    # set the running time of the motors to move
    time.sleep(running_time)
Beispiel #9
0
def leftSwingTurn(speed, running_time):

    # set the left motor pwm to be ready to stop
    # Turn Off Left PWM
    GPIO.output(setup.Motor_Left_PWM, GPIO.LOW)

    # set the right motor to go fowrard
    setup.rightmotor(setup.forward0)

    # set the right motor pwm to be ready to go forward
    GPIO.output(setup.Motor_Right_PWM, GPIO.HIGH)

    # set the speed of the left motor to stop
    setup.Left_Pwm.ChangeDutyCycle(0)
    # set the speed of the right motor to go fowrard
    setup.Right_Pwm.ChangeDutyCycle(speed)
    # set the running time of the right motor to go fowrard
    time.sleep(running_time)
Beispiel #10
0
def rightRoundTurn(speed_high, speed_low):

    # set the right motor to go fowrard
    setup.rightmotor(setup.forward0)

    # set the left motor to go fowrard
    setup.leftmotor(setup.forward0)

    # set the left motor pwm to be ready to go forward
    GPIO.output(setup.Motor_Left_PWM, GPIO.HIGH)

    # set the right motor pwm to be ready to stop
    # Turn Off Right PWM
    GPIO.output(setup.Motor_Right_PWM, GPIO.HIGH)

    # set the speed of the left motor to go fowrard
    setup.Left_Pwm.ChangeDutyCycle(speed_low)
    # set the speed of the right motor to stop
    setup.Right_Pwm.ChangeDutyCycle(speed_high)
Beispiel #11
0
def left_turn(speed, running_time):
'''Only the right wheel move forward to left turn
   speed is turn speed
   running_time is the time the wheel move'''

    # set the left motor pwm to be ready to stop
    # Turn Off Left PWM
    GPIO.output(setup.Motor_Left_PWM,GPIO.LOW)

    # set the right motor to go fowrard
    setup.rightmotor(setup.forward0)
    # set the right motor pwm to be ready to go forward
    GPIO.output(setup.Motor_Right_PWM,GPIO.HIGH)

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

    # set the running time of the right motor to go fowrard
    time.sleep(running_time)
Beispiel #12
0
def go_forward(speed):

    setup.leftmotor(setup.forward0)
    setup.rightmotor(setup.forward0)
    setup.Left_Pwm.ChangeDutyCycle(speed)
    setup.Right_Pwm.ChangeDutyCycle(speed)