-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
31 lines (27 loc) · 1.04 KB
/
main.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
27
28
29
30
31
# import sys
# import json
import time
from User import User
from SerialTransceiver import SerialTransceiver
import _thread
if __name__ == "__main__":
# userinfo = getinfo()
# user = User(int(userinfo['instanceID'],0),userinfo['port'])
user = User() #获取用户信息
#user.print()
serialTransceiver = SerialTransceiver(user)
_thread.start_new_thread(serialTransceiver.recieve,())
while True:
#time.sleep(1)
serialTransceiver.sendMsg()
# usermsg = input(f'0x0{user.instanceID}:')
# ser.write(f'0x0{user.instanceID} {time.asctime( time.localtime(time.time()))}: {usermsg}\n'.encode('utf8'))
# # Wait until there is data waiting in the serial buffer
# if ser.in_waiting > 0:
# # Read data out of the buffer until a carraige return / new line is found
# serialString = ser.readline()
# # Print the contents of the serial data
# try:
# print(serialString.decode("utf8"))
# except:
# pass