-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtakePicture.py
49 lines (40 loc) · 1.04 KB
/
takePicture.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
38
39
40
41
42
43
44
45
46
47
48
49
#Wakes Camera and Takes a Picture
import serial
import time
def takePic(num,delay):
i = 0
while i < num:
#Take Picture
port.write(b'\xAA\x04\x02\x00\x00\x00')
print("Taking Image")
#Wait for Data
time.sleep(140)
#Thanks Camera
port.write(b'\xAA\x0E\x0D\x00\x00\x00')
print("Data Recived")
i = i + 1
time.sleep(delay)
#Opens port
port = serial.Serial('/dev/ttyS0')
print("Serial Open")
#Reset Camera
port.write(b'\xAA\x08\x00\x00\x00\xFF')
time.sleep(1)
print("Camera Reset")
#Syncs Camera
syncCount = 0
while syncCount < 60:
port.write(b'\xAA\x0D\x00\x00\x00\x00')
syncCount = syncCount + 1
port.write(b'\xAA\x0E\x0D\x00\x00\x00')
print("Synced")
#Wait 2 Sec
time.sleep(2)
print("Warmed")
#Initalize Camera
port.write(b'\xAA\x01\x00\x08\x09\x07')
time.sleep(1)
port.write(b'\xAA\x15\x00\x00\x00\x00')
time.sleep(1)
print("Initalized")
takePic(1,1)