reamenagement
This commit is contained in:
24
SOFTWARE/plotter-app/websocket_test.py
Normal file
24
SOFTWARE/plotter-app/websocket_test.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import threading, websocket, time
|
||||
ws = websocket.WebSocket()
|
||||
ws.connect("ws://192.168.0.1:81")
|
||||
|
||||
# Reception needs to be done in a separate thread; you cannot
|
||||
# assume that a given command will always result in exactly one
|
||||
# response at a predictable time
|
||||
# def receiver():
|
||||
# while True:
|
||||
# for l in ws.recv().splitlines():
|
||||
# if isinstance(l, str):
|
||||
# print(l)
|
||||
# else:
|
||||
# print(str(l, 'utf-8'))
|
||||
|
||||
# t = threading.Thread(target=receiver)
|
||||
# t.start()
|
||||
|
||||
# ws.send("?") # realtime characters need no line terminator
|
||||
# ws.send("$/axes/x\n") # line-oriented commands need \n at the end
|
||||
ws.send("\r\n\r\n")
|
||||
print(ws.recv())
|
||||
ws.send("G0 X10\n")
|
||||
print(ws.recv())
|
||||
Reference in New Issue
Block a user