コード例 #1
0
ファイル: go_turn_stop.py プロジェクト: hj9097/practice
def right_turn(speed, running_time):

    setup.leftmotor(setup.forward0)
    GPIO.output(setup.Motor_Left_PWM, GPIO.HIGH)
    GPIO.output(setup.Motor_Right_PWM, GPIO.LOW)
    setup.Left_Pwm.ChangeDutyCycle(speed)
    setup.Right_Pwm.ChangeDutyCycle(0)
    time.sleep(running_time)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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()
コード例 #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()
コード例 #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)
コード例 #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)
コード例 #9
0
def rightSwingTurn(speed, running_time):

    # 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.LOW)
    # set the speed of the left motor to go fowrard
    setup.Left_Pwm.ChangeDutyCycle(speed)
    # set the speed of the right motor to stop
    setup.Right_Pwm.ChangeDutyCycle(0)
    # set the running time of the left motor to go fowrard
    time.sleep(running_time)
コード例 #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)
コード例 #11
0
def right_turn(speed, running_time):
'''Only the left wheel move forward to right turn
   speed is turn speed
   running_time is the time the wheel move'''

    # 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.LOW)

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

    # set the running time of the left motor to go fowrard
    time.sleep(running_time)
コード例 #12
0
ファイル: go_turn_stop.py プロジェクト: hj9097/practice
def go_forward(speed):

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