Skip to content

Instantly share code, notes, and snippets.

@bennuttall bennuttall/
Last active May 2, 2017

What would you like to do?
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)
motors = (motor1, motor2, motor3, motor4)
for motor in motors:

This comment has been minimized.

Copy link
Owner Author

commented Jun 15, 2016


motor.forward()  # full speed forwards
motor.forward(0.5)  # half speed forwards

motor.backward()  # full speed backwards
motor.backward(0.5)  # half speed backwards

motor.stop()  # stop the motor

motor.value = 0.5  # half speed forwards
motor.value = -0.5  # half speed backwards
motor.value = 0  # stop

motor.reverse()  # reverse direction at same speed, e.g...

motor.forward(0.5)  # going forward at half speed
motor.reverse()  # now going backwards at half speed

This comment has been minimized.

Copy link

commented Mar 7, 2017

I tried to to have control using but it seems pizero is not enough powerfull

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.