mirror of
https://github.com/YikeStone/ros_arduino_bridge.git
synced 2025-08-03 11:14:08 +05:30
Added missing pin_mode statements to Analog and AnalogFloat sensor types
This commit is contained in:
parent
f2d40aa724
commit
8e6b2ff0ce
@ -89,6 +89,13 @@ class AnalogSensor(Sensor):
|
||||
|
||||
self.pub = rospy.Publisher("~sensor/" + self.name, Analog)
|
||||
|
||||
if self.direction == "output":
|
||||
self.controller.pin_mode(self.pin, OUTPUT)
|
||||
else:
|
||||
self.controller.pin_mode(self.pin, INPUT)
|
||||
|
||||
self.value = LOW
|
||||
|
||||
def read_value(self):
|
||||
return self.controller.analog_read(self.pin)
|
||||
|
||||
@ -106,6 +113,19 @@ class AnalogFloatSensor(Sensor):
|
||||
|
||||
self.pub = rospy.Publisher("~sensor/" + self.name, AnalogFloat)
|
||||
|
||||
if self.direction == "output":
|
||||
self.controller.pin_mode(self.pin, OUTPUT)
|
||||
else:
|
||||
self.controller.pin_mode(self.pin, INPUT)
|
||||
|
||||
self.value = LOW
|
||||
|
||||
def read_value(self):
|
||||
return self.controller.analog_read(self.pin)
|
||||
|
||||
def write_value(self, value):
|
||||
return self.controller.analog_write(self.pin, value)
|
||||
|
||||
|
||||
class DigitalSensor(Sensor):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
Loading…
x
Reference in New Issue
Block a user