-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfin.py
105 lines (104 loc) · 7.87 KB
/
fin.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import time
import os
import serial
import sys
import subprocess
from subprocess import Popen
import RPi.GPIO as GPIO
ser = serial.Serial("/dev/ttyAMA0", 9600, timeout=0, parity = serial.PARITY_NONE, stopbits = serial.STOPBITS_ONE, bytesize = serial.EIGHTBITS)
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(21,GPIO.OUT)
while (1):
print('reading...')
start = ser.readline(1)
if (start == 'h'):
ayu = Popen(['omxplayer','/boot/menu/ayu.mp4'], stdin=subprocess.PIPE)
time.sleep(13)
ayu.stdin.write('q')
lan = Popen(['omxplayer','/boot/menu/lang.mp4'], stdin=subprocess.PIPE)
while (1):
lang = ser.readline(1)
if (lang == 'a'):
lan.stdin.write('q')
aa = Popen(['omxplayer','/boot/menu/1e.mp4'], stdin=subprocess.PIPE)
while (1):
wht = ser.readline(1)
if (wht == 'a'):
aa.stdin.write('q')
bb = Popen(['omxplayer','/boot/menu/2e.mp4'], stdin=subprocess.PIPE)
while (1):
z =ser.readline(1)
if (z == 'c'):
bb.stdin.write('q')
ser.write('f')
cc = Popen(['omxplayer','--loop','/boot/menu/3e.mp4'], stdin=subprocess.PIPE)
GPIO.output(21,True)
time.sleep(0.5)
GPIO.output(21,False)
while (1):
zz = ser.readline(1)
if (zz == 'e'):
cc.stdin.write('q')
arrived = Popen(['omxplayer','/boot/menu/4e.mp4'],stdin=subprocess.PIPE)
time.sleep(13)
break
arrived.stdin.write('q')
break
break
break
elif (lang == 'b'):
lan.stdin.write('q')
smenu = Popen(['omxplayer','/boot/menu/1s.mp4'], stdin=subprocess.PIPE)
while(1):
mokak = ser.readline(1)
if (mokak == 'a'):
smenu.stdin.write('q')
bb = Popen(['omxplayer','/boot/menu/2s.mp4'], stdin=subprocess.PIPE)
while (1):
z =ser.readline(1)
if (z == 'c'):
bb.stdin.write('q')
cc = Popen(['omxplayer','--loop','/boot/menu/3s.mp4'], stdin=subprocess.PIPE)
GPIO.output(21,True)
time.sleep(0.5)
GPIO.output(21,False)
while (1):
zz = ser.readline(1)
if (zz == 'e'):
cc.stdin.write('q')
arrived = Popen(['omxplayer','/boot/menu/4s.mp4'],stdin=subprocess.PIPE)
time.sleep(13)
break
arrived.stdin.write('q')
break
break
break
elif (lang == 'c'):
lan.stdin.write('q')
smenu = Popen(['omxplayer','/boot/menu/1s.mp4'], stdin=subprocess.PIPE)
while(1):
mokak = ser.readline(1)
if (mokak == 'a'):
smenu.stdin.write('q')
bb = Popen(['omxplayer','/boot/menu/2s.mp4'], stdin=subprocess.PIPE)
while (1):
z =ser.readline(1)
if (z == 'c'):
bb.stdin.write('q')
cc = Popen(['omxplayer','--loop','/boot/menu/3s.mp4'], stdin=subprocess.PIPE)
GPIO.output(21,True)
time.sleep(0.5)
GPIO.output(21,False)
while (1):
zz = ser.readline(1)
if (zz == 'e'):
cc.stdin.write('q')
arrived = Popen(['omxplayer','/boot/menu/4s.mp4'],stdin=subprocess.PIPE)
time.sleep(13)
break
arrived.stdin.write('q')
break
break
break
time.sleep(1)