Make it more clear how the pins/pin software used is working.

This commit is contained in:
Piv
2019-09-22 20:25:05 +09:30
parent 0f83080c75
commit 991026103c

View File

@@ -1,11 +1,14 @@
import os
from gpiozero import Servo
from gpiozero import Servo, Device
GPIOZERO_PIN_FACTORY = "piggpio"
class Motor:
def __init__(self, motor_pin=19):
# This may not work properly, should print.
os.environ["GPIOZERO_PIN_FACTORY"] = GPIOZERO_PIN_FACTORY
print('Using pin factory: ' + Device.pin_factory)
# This will say it fails if pigpio daemon is already started, just ignore it.
os.system("sudo pigpiod")
self.set_motor_pin(motor_pin)
self.initialise_motor()