-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
executable file
·156 lines (140 loc) · 4.11 KB
/
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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# SPDX-FileCopyrightText: 2021 faye archip
# SPDX-License-Identifier: MIT
"""Simple test for keypad on I2C RGB character LCD Shield or Pi Plate kits"""
import time
import board
import adafruit_character_lcd.character_lcd_rgb_i2c as character_lcd
import socket
import subprocess
import sys
# Modify this if you have a different sized Character LCD
lcd_columns = 16
lcd_rows = 2
eqflag = 0
escape = 0
# Initialise I2C bus.
i2c = board.I2C() # uses board.SCL and board.SDA
#kill running sound bridges
subprocess.run(["killall","pacat"])
# Initialise the LCD class
lcd = character_lcd.Character_LCD_RGB_I2C(i2c, lcd_columns, lcd_rows)
lcd.clear()
#ips=socket.gethostbyname(socket.gethostname())
lcd.message = "AUDIO BRIDGE \n ANALOG TO CAT"
#print(ips)
lcd.color = [100, 0, 0]
while True:
if lcd.left_button:
# print("Left!")
lcd.message = "Turn on =^_^=\nWith EQ"
subprocess.run("./EQon.sh")
subprocess.run("./neko.sh")
elif lcd.up_button:
# print("Up!")
lcd.clear()
lcd.message = "Show light"
subprocess.run("./show.sh")
elif lcd.down_button:
# print("Down!")
lcd.clear()
lcd.message = "EQoff"
subprocess.run("./EQoff.sh")
elif lcd.right_button:
# print("Right!")
lcd.clear()
lcd.message = "Turn off =^_^="
subprocess.run(["killall","pacat"])
elif lcd.select_button:
lcd.clear()
lcd.message = "House lights"
subprocess.run("./houselight.sh")
"""
lcd.message = "House lights"
if eqflag == 1:
lcd.clear()
lcd.message = "ON, Press DWN to\nTurn off "
escape = 0
while escape == 0:
if lcd.select_button:
escape = 1
lcd.message ="EXIT"
lcd.clear()
elif lcd.down_button:
escape = 1
eqflag = 0
#poke the xair here
lcd.message = "TURNING OFF EQ"
time.sleep(.5)
lcd.clear()
time.sleep(0.5)
if eqflag == 0:
lcd.clear()
lcd.message = "OFF, Press UP\n to Turn ON "
escape = 0
while escape == 0:
if lcd.select_button:
escape = 1
lcd.message ="EXIT"
lcd.clear()
elif lcd.up_button:
escape = 1
eqflag = 1
#xair poke
lcd.message = "TURNING ON EQ"
lcd.clear()
time.sleep(0.5) */
"""
time.sleep(0.5)
# lcd.clear()
def lights(switch):
#this function will call shell scripts to trigger the lighing controler Lightfactory
#0 switch to lightinng mode on controler
#1 House lights
#2 Blue
#3 Red
#4 Show
#5 Fay Look
#6 Panic
if switch == 1: #house lights
#do house lights
lcd.clear()
elif switch == 2: # Blue
#do blue
lcd.clear()
elif switch == 3:
#do red
lcd.clear()
elif switch == 4:
#do show
lcd.clear()
elif switch == 5:
#do fay's look
lcd.clear()
elif switch == 6:
#do panic
lcd.clear()
elif switch == 0:
#do control function
while True:
if lcd.left_button:
# print("Left!")
lcd.message = "lighting control mode"
elif lcd.up_button:
# print("Up!")
lcd.clear()
lcd.message = "EQon"
elif lcd.down_button:
# print("Down!")
lcd.clear()
lcd.message = "EQoff"
subprocess.run("./EQoff.sh")
elif lcd.right_button:
# print("Right!")
lcd.clear()
lcd.message = "Turn off =^_^="
subprocess.run(["killall","pacat"])
elif lcd.select_button:
lcd.clear()
lcd.message = "House lights"
subprocess.run("./houselight.sh")
time.sleep(0.5)