Spaces:
Runtime error
Runtime error
Commit
·
cd2036c
1
Parent(s):
ddc6310
Update main.py
Browse files
main.py
CHANGED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import package as pk
|
3 |
+
st.title("LightApp")
|
4 |
+
PORT = st.selectbox(label = "Select COM-Port",options = range(1,31))
|
5 |
+
ConnectButton = st.button(label = "Connect",help = "Select Your Com Port And Click To Connect Button.")
|
6 |
+
if ConnectButton:
|
7 |
+
e = False
|
8 |
+
try:
|
9 |
+
pk.Connect("COM"+str(PORT))
|
10 |
+
except:
|
11 |
+
e = True
|
12 |
+
if e:
|
13 |
+
st.error("Port not founded.")
|
14 |
+
else:
|
15 |
+
st.success("Connected!")
|
16 |
+
st.write("Controll Page")
|
17 |
+
RH = st.button("Red-ON")
|
18 |
+
RL = st.button("Red-OFF")
|
19 |
+
GH = st.button("Green-ON")
|
20 |
+
GL = st.button("Green-OFF")
|
21 |
+
BH = st.button("Blue-ON")
|
22 |
+
BL = st.button("Blue-OFF")
|
23 |
+
if RH:
|
24 |
+
pk.R(True)
|
25 |
+
if RL:
|
26 |
+
pk.R(False)
|
27 |
+
if GH:
|
28 |
+
pk.G(True)
|
29 |
+
if GL:
|
30 |
+
pk.G(False)
|
31 |
+
if BH:
|
32 |
+
pk.B(True)
|
33 |
+
if BL:
|
34 |
+
pk.B(False)
|