Explicitly use pin factories for servo/motor.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from threading import Timer, Thread
|
from threading import Timer, Thread
|
||||||
from gpiozero import Servo
|
from gpiozero import Servo, Device
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ class MotorServicer(motorService_pb2_grpc.CarControlServicer):
|
|||||||
return grpc.ssl_server_credentials([[pvtKeyBytes, pvtCertBytes]])
|
return grpc.ssl_server_credentials([[pvtKeyBytes, pvtCertBytes]])
|
||||||
|
|
||||||
motor = Motor()
|
motor = Motor()
|
||||||
servo = Servo(servo_pin)
|
servo = Servo(servo_pin, Device.pin_factory)
|
||||||
servicer = MotorServicer(motor, servo)
|
servicer = MotorServicer(motor, servo)
|
||||||
|
|
||||||
service_thread = Thread(target=servicer.start_server)
|
service_thread = Thread(target=servicer.start_server)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class Motor:
|
|||||||
if self._motor_pin is None:
|
if self._motor_pin is None:
|
||||||
print("Motor pin number is not set.")
|
print("Motor pin number is not set.")
|
||||||
return
|
return
|
||||||
self._servo = Servo(self._motor_pin)
|
self._servo = Servo(self._motor_pin, pin_factory=Device.pin_factory)
|
||||||
|
|
||||||
def set_throttle(self, throttle):
|
def set_throttle(self, throttle):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user