Added sensor open and close and debug prints

This commit is contained in:
Maximilian Giller 2021-10-07 12:28:04 +02:00
parent 3ea7d7453d
commit edfbe4e6c3

View file

@ -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: