Can anybody help with this Error?
Posted: Thu Mar 30, 2017 10:38 pm
This is my code:
Im getting this error, please help me
Traceback (most recent call last):
File "servo-4.py", line 8, in <module>
pigpio.start()
AttributeError: 'module' object has no attribute 'start'
Code: Select all
import time
import pigpio
servos = [4,7] #GPIO number
pigpio.start()
#pulsewidth can only set between 500-2500
try:
while True:
pigpio.set_servo_pulsewidth(servos[0], 500) #servo 1 to 0 degree
print("Servo {} {} micro pulses".format(servos, 500))
time.sleep(1)
pigpio.set_servo_pulsewidth(servos[1], 1500) #servo 2 to 90 degree
print("Servo {} {} micro pulses".format(servos, 1500))
time.sleep(1)
pigpio.set_servo_pulsewidth(servos[0], 1500)
print("Servo {} {} micro pulses".format(servos, 1500))
time.sleep(1)
pigpio.set_servo_pulsewidth(servos[1], 500)
print("Servo {} {} micro pulses".format(servos, 500))
time.sleep(1)
# switch all servos off
except KeyboardInterrupt:
for s in servos:
pigpio.set_servo_pulsewidth(s, 0);
pigpio.stop()Traceback (most recent call last):
File "servo-4.py", line 8, in <module>
pigpio.start()
AttributeError: 'module' object has no attribute 'start'