Make it more clear how the pins/pin software used is working.
This commit is contained in:
@@ -1,11 +1,14 @@
|
|||||||
import os
|
import os
|
||||||
from gpiozero import Servo
|
from gpiozero import Servo, Device
|
||||||
|
|
||||||
GPIOZERO_PIN_FACTORY = "piggpio"
|
GPIOZERO_PIN_FACTORY = "piggpio"
|
||||||
|
|
||||||
class Motor:
|
class Motor:
|
||||||
def __init__(self, motor_pin=19):
|
def __init__(self, motor_pin=19):
|
||||||
|
# This may not work properly, should print.
|
||||||
os.environ["GPIOZERO_PIN_FACTORY"] = GPIOZERO_PIN_FACTORY
|
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")
|
os.system("sudo pigpiod")
|
||||||
self.set_motor_pin(motor_pin)
|
self.set_motor_pin(motor_pin)
|
||||||
self.initialise_motor()
|
self.initialise_motor()
|
||||||
|
|||||||
Reference in New Issue
Block a user