Skip to content

Commit a698658

Browse files
committed
override on for distance sensor
1 parent 6ba3d50 commit a698658

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

buildhat/distance.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(self, port, threshold_distance=100):
1313
super().__init__(port)
1414
if self.typeid != 62:
1515
raise DeviceInvalid('There is not a distance sensor connected to port %s (Found %s)' % (port, self.name))
16-
self.reverse()
16+
self.on()
1717
self.mode(0)
1818
self._cond_data = Condition()
1919
self._when_in_range = None
@@ -136,3 +136,9 @@ def eyes(self, *args):
136136
raise DistanceSensorException("Need 4 brightness args, of 0 to 100")
137137
out += [v]
138138
self._write1(out)
139+
140+
def on(self):
141+
"""
142+
Turns on the sensor
143+
"""
144+
self._write("port {} ; set -1\r".format(self.port))

0 commit comments

Comments
 (0)