client server communication implemented
This commit is contained in:
+6
-4
@@ -1,7 +1,8 @@
|
||||
import socket
|
||||
import ws2801
|
||||
|
||||
def start_server():
|
||||
host = socket.gethostname()
|
||||
def start():
|
||||
host = "0.0.0.0"
|
||||
port = 5000
|
||||
|
||||
server_socket = socket.socket()
|
||||
@@ -14,8 +15,9 @@ def start_server():
|
||||
while True:
|
||||
# receive data stream. it won't accept data packet greater than 1024 bytes
|
||||
data = conn.recv(1024).decode()
|
||||
print(str(data))
|
||||
r,g,b = ws2801.hex_to_rgb(data)
|
||||
ws2801.set_color(r,g,b)
|
||||
|
||||
|
||||
conn.close() # close the connection
|
||||
|
||||
start()
|
||||
|
||||
Reference in New Issue
Block a user