Skip to content

Commit 3b07ba6

Browse files
authored
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.
1 parent 678f47c commit 3b07ba6

File tree

1 file changed

+8
-3
lines changed
  • MEMENTO/Memento_IOT_Doorbell

1 file changed

+8
-3
lines changed

MEMENTO/Memento_IOT_Doorbell/code.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,24 @@ def capture_send_image():
8383
print("Sent image to IO!")
8484
else:
8585
print("ERROR: JPEG frame capture failed!")
86-
print("DONE, waiting for next press..")
87-
# Turn the LED on to signal that the doorbell is ready to be pressed again
88-
led.value = True
8986

9087

9188
while True:
9289
# Wait until the doorbell is pressed
9390
if not pin_button.value:
9491
print("Doorbell pressed!")
92+
9593
# Turn the doorbell LED off to signal that it has been pressed
9694
led.value = False
95+
9796
# Play a doorbell tone using the speaker
9897
pycam.tone(95, 0.5)
9998
pycam.tone(70, 0.5)
99+
100100
capture_send_image()
101+
102+
print("DONE, waiting for next press..")
103+
104+
# Turn the LED on to signal that the doorbell is ready to be pressed again
105+
led.value = True
101106
time.sleep(0.01)

0 commit comments

Comments
 (0)