Fixed the problem of rpi_ws281x library and starting the server without
interface
This commit is contained in:
a838557765 2021-01-04 15:56:32 +08:00
parent 197ee86b5d
commit d8141ca9d0
2 changed files with 13 additions and 8 deletions

View File

@ -27,9 +27,18 @@ class Servo:
# Main program logic follows:
if __name__ == '__main__':
print("Now servos will rotate to 90°.")
print("If they have already been at 90°, nothing will be observed.")
print("Please keep the program running when installing the servos.")
print("After that, you can press ctrl-C to end the program.")
pwm=Servo()
pwm.setServoPwm('0',90)
pwm.setServoPwm('1',90)
while True:
try :
pwm.setServoPwm('0',90)
pwm.setServoPwm('1',90)
except KeyboardInterrupt:
print ("\nEnd of program")
break

View File

@ -9,14 +9,10 @@ for x in range(1,4):
flag=flag | 0x01
break
for x in range(1,4):
if os.system("sudo pip3 install rpi_ws281x") == 0:
if os.system("sudo apt-get install -y python3-dev python3-pyqt5 ") == 0:
flag=flag | 0x02
break
for x in range(1,4):
if os.system("sudo apt-get install -y python3-dev python3-pyqt5 ") == 0:
flag=flag | 0x04
break
if flag==0x07:
if flag==0x03:
print("\nNow the installation is successful.")
else:
print ("\nSome libraries have not been installed yet. Please run 'sudo python setup.py' again")