Created
July 14, 2017 04:59
-
-
Save nooitaf/bc05562425af7fb1371fde1a3c1f4a54 to your computer and use it in GitHub Desktop.
motozero - test all motors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gpiozero import Motor, OutputDevice | |
from time import sleep | |
motor1 = Motor(24, 27) | |
motor1_enable = OutputDevice(5, initial_value = 1) | |
motor2 = Motor(6, 22) | |
motor2_enable = OutputDevice(17, initial_value = 1) | |
motor3 = Motor(23, 16) | |
motor3_enable = OutputDevice(12, initial_value = 1) | |
motor4 = Motor(13, 18) | |
motor4_enable = OutputDevice(25, initial_value = 1) | |
motor1.value = 0.5 # half speed forwards | |
motor2.value = 0.5 # half speed forwards | |
motor3.value = 0.5 # half speed forwards | |
motor4.value = 0.5 # half speed forwards | |
sleep(3) | |
motor1.value = -0.5 # half speed backwards | |
motor2.value = -0.5 # half speed backwards | |
motor3.value = -0.5 # half speed backwards | |
motor4.value = -0.5 # half speed backwards | |
sleep(3) | |
motor1.value = 0 # stop | |
motor2.value = 0 # stop | |
motor3.value = 0 # stop | |
motor4.value = 0 # stop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment