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:
parent
678f47c028
commit
3b07ba638d
1 changed files with 8 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue