-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathServer.py
27 lines (24 loc) · 793 Bytes
/
Server.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
import connection
def main():
print("....")
print("server started at",connection.ipv4)
while True:
try:
c = connection.socket_conn()
c.listen(1)
conn, client_addr = c.accept()
print("connected with: ",client_addr)
signal = conn.recv(512).decode('utf-8')
connection.serial0.write(signal.encode('utf-8'))
print(signal)
c.close()
except:
print("stoping all motor functions")
ard = connection.arduino_conn()
halt_drive_motors = 'b'
ard.write(halt_drive_motors.encode('utf-8'))
halt_arm_motors = 'v'
ard.write(halt_arm_motors.encode('utf-8'))
break
if __name__ == "__main__":
main()