Skip to content

Instantly share code, notes, and snippets.

@nooitaf
Created July 14, 2017 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nooitaf/bc05562425af7fb1371fde1a3c1f4a54 to your computer and use it in GitHub Desktop.
Save nooitaf/bc05562425af7fb1371fde1a3c1f4a54 to your computer and use it in GitHub Desktop.
motozero - test all motors
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