Added sensor open and close and debug prints
This commit is contained in:
parent
3ea7d7453d
commit
edfbe4e6c3
1 changed files with 6 additions and 0 deletions
|
@ -31,9 +31,13 @@ class PeopleCounter ():
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.sensor.open()
|
||||||
while self.keepRunning:
|
while self.keepRunning:
|
||||||
# Switch to other direction
|
# Switch to other direction
|
||||||
direction: Directions = Directions.other(direction)
|
direction: Directions = Directions.other(direction)
|
||||||
|
print("-" * 20)
|
||||||
|
print("Direction:",direction)
|
||||||
|
print("At time",datetime.now())
|
||||||
|
|
||||||
self.sensor.setDirection(direction)
|
self.sensor.setDirection(direction)
|
||||||
|
|
||||||
|
@ -44,6 +48,8 @@ class PeopleCounter ():
|
||||||
if changed:
|
if changed:
|
||||||
countChange: int = self.getCountChange(self.directionState)
|
countChange: int = self.getCountChange(self.directionState)
|
||||||
self.handleCallbacks(countChange)
|
self.handleCallbacks(countChange)
|
||||||
|
|
||||||
|
self.sensor.close()
|
||||||
|
|
||||||
def getCountChange(self, directionState) -> int:
|
def getCountChange(self, directionState) -> int:
|
||||||
# Is valid?
|
# Is valid?
|
||||||
|
|
Loading…
Reference in a new issue