Readability improvements

The LED is disabled in the main loop, so re-enabling it in the main loop makes more sense; also added some spacing between steps.
This commit is contained in:
Jacob Rose 2024-02-13 13:00:36 -05:00 committed by GitHub
parent 678f47c028
commit 3b07ba638d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -83,19 +83,24 @@ def capture_send_image():
print("Sent image to IO!")
else:
print("ERROR: JPEG frame capture failed!")
print("DONE, waiting for next press..")
# Turn the LED on to signal that the doorbell is ready to be pressed again
led.value = True
while True:
# Wait until the doorbell is pressed
if not pin_button.value:
print("Doorbell pressed!")
# Turn the doorbell LED off to signal that it has been pressed
led.value = False
# Play a doorbell tone using the speaker
pycam.tone(95, 0.5)
pycam.tone(70, 0.5)
capture_send_image()
print("DONE, waiting for next press..")
# Turn the LED on to signal that the doorbell is ready to be pressed again
led.value = True
time.sleep(0.01)