I built a buggy:
it seems like it works correctly, except the motor doesn’t stop even when I run
robby.stop() is there some other command I should use instead?
Program I Ran:
from gpiozero import Robot robby = Robot(left=(7,8), right=(9,10))
then in the python shell I ran
robby.forward() which started the motor.
NOTE: When the board has power the motor goes forward even with the pi turned off.
gpioZero buggy won’t stop! 😦
Try my buggy program for your buggy! 🙂
# Driving One Motor Using GpioZeo and L298N v0.01 tlfong01 2019jun11hkt1156 # rpi3B+ python 3.5.3 gpiozero 1.5.0 L298N # wiring - from time import sleep from gpiozero import Motor motor = Motor(17, 18) motor.forward() sleep(2) motor.backward() sleep(2) motor.reverse sleep(2) motor.stop()
Appendix A – Summary of Class motor and its methods
from gpiozero import Motor
motor = Motor(17, 18)
Drive the motor forward
Drive the motor backward
Reverse the current direction of the motor
Stop the motor.