We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I #!/usr/bin/python
import PiMotor import time import RPi.GPIO as GPIO
#Name of Individual MOTORS m1 = PiMotor.Motor("MOTOR1",1) m2 = PiMotor.Motor("MOTOR2",1) m3 = PiMotor.Motor("MOTOR3",1) m4 = PiMotor.Motor("MOTOR4",1)
#To drive all motors together motorAll = PiMotor.LinkedMotors(m1,m2,m3,m4)
#Names for Individual Arrows ab = PiMotor.Arrow(1) al = PiMotor.Arrow(2) af = PiMotor.Arrow(3) ar = PiMotor.Arrow(4)
##This segment drives the motors in the direction listed below:
try: while True: #-----------To Drive the Motors Forward------------# print("Robot Moving Forward ") af.on() motorAll.forward(100) time.sleep(5) #--------------------------------------------------#
#-----------To Drive the Motors backwards------------# print("Robot Moving Backward ") af.off() ab.on() motorAll.reverse(100) time.sleep(5) #--------------------------------------------------#
#-----------To Drive the Motors Left---------------# print("Robot Moving Left ") ab.off() al.on() m1.stop() m2.stop() m3.forward(100) m4.forward(100) time.sleep(5) #--------------------------------------------------#
#----------To Drive the Motors Right---------------# print("Robot Moving Right ") ar.on() al.off() m1.forward(100) m2.forward(100) m3.stop() m4.stop() time.sleep(5) #-------------------------------------------------#
#---------To Stop the Motors----------------------# print("Robot Stop ") al.off() af.off() ar.off() motorAll.stop() time.sleep(5) #-------------------------------------------------#
except KeyboardInterrupt: GPIO.cleanup()
am using a MotorShield on an RPi 3B with the following code . I get error PiMotor has no attribute "Motor" Any suggestions?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I #!/usr/bin/python
import PiMotor
import time
import RPi.GPIO as GPIO
#Name of Individual MOTORS
m1 = PiMotor.Motor("MOTOR1",1)
m2 = PiMotor.Motor("MOTOR2",1)
m3 = PiMotor.Motor("MOTOR3",1)
m4 = PiMotor.Motor("MOTOR4",1)
#To drive all motors together
motorAll = PiMotor.LinkedMotors(m1,m2,m3,m4)
#Names for Individual Arrows
ab = PiMotor.Arrow(1)
al = PiMotor.Arrow(2)
af = PiMotor.Arrow(3)
ar = PiMotor.Arrow(4)
##This segment drives the motors in the direction listed below:
forward and reverse takes speed in percentage(0-100)
try:
while True:
#-----------To Drive the Motors Forward------------#
print("Robot Moving Forward ")
af.on()
motorAll.forward(100)
time.sleep(5)
#--------------------------------------------------#
#-----------To Drive the Motors backwards------------#
print("Robot Moving Backward ")
af.off()
ab.on()
motorAll.reverse(100)
time.sleep(5)
#--------------------------------------------------#
#-----------To Drive the Motors Left---------------#
print("Robot Moving Left ")
ab.off()
al.on()
m1.stop()
m2.stop()
m3.forward(100)
m4.forward(100)
time.sleep(5)
#--------------------------------------------------#
#----------To Drive the Motors Right---------------#
print("Robot Moving Right ")
ar.on()
al.off()
m1.forward(100)
m2.forward(100)
m3.stop()
m4.stop()
time.sleep(5)
#-------------------------------------------------#
#---------To Stop the Motors----------------------#
print("Robot Stop ")
al.off()
af.off()
ar.off()
motorAll.stop()
time.sleep(5)
#-------------------------------------------------#
except KeyboardInterrupt:
GPIO.cleanup()
am using a MotorShield on an RPi 3B with the following code . I get error PiMotor has no attribute "Motor"
Any suggestions?
The text was updated successfully, but these errors were encountered: