-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
37 lines (27 loc) · 890 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/python
import time
from includes.picture import Picture
from includes.just_email import JustEmail
from includes.pusher_trigger import PusherTrigger
from gpiozero import MotionSensor
from settings import general
class Main:
def __init__(self):
pic = Picture()
pusher = PusherTrigger()
pir = MotionSensor(4)
while True:
if pir.motion_detected:
pusher.shoot()
email = JustEmail()
email.make_message()
images = []
for i in range(0, general['PIC_AMOUNT']):
name = pic.create_name()
pic.take_pic(name)
images.append(name)
time.sleep(general['INTERVAL'])
email.add_images(images)
email.send_mail()
if __name__ == "__main__":
Main()