-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest7.py
70 lines (55 loc) · 1.92 KB
/
test7.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# -*- coding: utf-8 -*-
from controller import *
from time import sleep, time
def read_process():
# Read the image identification numbers from the `resim_id_listesi` list and return them as a dictionary.
resim_id_listesi = [12, 11, 1, 2, 3, 4, 5, 10, 6]
# The `resim_id_listesi` list contains the image identification numbers.
operations = {
1: controller_forward,
2: controller_right,
3: controller_backward,
4: controller_left,
5: controller_dance,
6: controller_close,
7: controller_crotate,
8: controller_rotate,
9: controller_fastforward,
10: controller_music,
11: controller_fire,
12: controller_music1,
}
# The `operations` dictionary contains the functions that will be executed for each image identification number.
try:
reads = dict()
for i in range(9):
resim_id = resim_id_listesi[i]
reads[i] = resim_id
# Execute the corresponding function.
if resim_id in operations:
operations[resim_id]()
sleep(1) # Bu iniz gibi ayarlayabilirsiniz.
else:
print("Gersiz resim_id:", resim_id)
return reads
except KeyboardInterrupt:
raise
def main():
# Initialize the controller.
controller_init()
# Enter an infinite loop.
while True:
# Get the image identification numbers.
reads = read_process()
# Iterate over the image identification numbers.
for i in reads:
# Execute the corresponding function.
if reads[i] == 6: # 6 numaral
controller_close()
exit(0)
elif reads[i] > 0 and reads[i] <= 10:
print(f"lem {reads[i]} al.")
else:
print(f"Geenek ({reads[i]}) girdiniz. Ler girin.")
if __name__ == "__main__":
main()