trying to run socket in background
parent
f27539746e
commit
376edc47be
14
main.py
14
main.py
|
@ -100,15 +100,15 @@ if __name__ == '__main__':
|
|||
GPIO.add_event_detect(13, GPIO.RISING, callback=power_toggle, bouncetime=300)
|
||||
GPIO.add_event_detect(19, GPIO.RISING, callback=change_idle_mode, bouncetime=300)
|
||||
|
||||
# with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||
# s.bind((SOCKET_BIND_IP, SOCKET_BIND_PORT))
|
||||
# s.listen()
|
||||
# conn, addr = s.accept()
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||
s.bind((SOCKET_BIND_IP, SOCKET_BIND_PORT))
|
||||
s.listen(1)
|
||||
conn, addr = s.accept()
|
||||
try:
|
||||
while True:
|
||||
# socket_data = conn.recv(1024)
|
||||
# print(socket_data)
|
||||
# print(type(socket_data))
|
||||
socket_data = conn.recv(1024)
|
||||
print(socket_data)
|
||||
print(type(socket_data))
|
||||
if led_power == True:
|
||||
if check_internet() == False:
|
||||
blink(strip, Color(255,0,0), Color(255,255,255))
|
||||
|
|
Loading…
Reference in New Issue