From 2518cd79836b5bb35072b72e33713c2c3bba6f7e Mon Sep 17 00:00:00 2001 From: Piv <18462828+Piv200@users.noreply.github.com> Date: Sun, 24 Nov 2019 14:10:10 +1030 Subject: [PATCH] Explicitly use pin factories for servo/motor. --- MotorControl/MotorServer.py | 4 ++-- MotorControl/gpiozero/motor_session.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MotorControl/MotorServer.py b/MotorControl/MotorServer.py index 5d4983c..9205a55 100755 --- a/MotorControl/MotorServer.py +++ b/MotorControl/MotorServer.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 from threading import Timer, Thread -from gpiozero import Servo +from gpiozero import Servo, Device from concurrent import futures import time @@ -72,7 +72,7 @@ class MotorServicer(motorService_pb2_grpc.CarControlServicer): return grpc.ssl_server_credentials([[pvtKeyBytes, pvtCertBytes]]) motor = Motor() -servo = Servo(servo_pin) +servo = Servo(servo_pin, Device.pin_factory) servicer = MotorServicer(motor, servo) service_thread = Thread(target=servicer.start_server) diff --git a/MotorControl/gpiozero/motor_session.py b/MotorControl/gpiozero/motor_session.py index 45362a0..5dd6cb3 100644 --- a/MotorControl/gpiozero/motor_session.py +++ b/MotorControl/gpiozero/motor_session.py @@ -17,7 +17,7 @@ class Motor: if self._motor_pin is None: print("Motor pin number is not set.") return - self._servo = Servo(self._motor_pin) + self._servo = Servo(self._motor_pin, pin_factory=Device.pin_factory) def set_throttle(self, throttle): try: