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:
|
||||
# Switch to other direction
|
||||
direction: Directions = Directions.other(direction)
|
||||
print("-" * 20)
|
||||
print("Direction:",direction)
|
||||
print("At time",datetime.now())
|
||||
|
||||
self.sensor.setDirection(direction)
|
||||
|
||||
|
@ -45,6 +49,8 @@ class PeopleCounter ():
|
|||
countChange: int = self.getCountChange(self.directionState)
|
||||
self.handleCallbacks(countChange)
|
||||
|
||||
self.sensor.close()
|
||||
|
||||
def getCountChange(self, directionState) -> int:
|
||||
# Is valid?
|
||||
for direction in Directions:
|
||||
|
|
Loading…
Reference in a new issue