-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·34 lines (31 loc) · 1.04 KB
/
Copy pathtest.py
File metadata and controls
executable file
·34 lines (31 loc) · 1.04 KB
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
32
33
34
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from PyQt5.QtCore import QCoreApplication
from PyQt5.QtSerialPort import QSerialPort, QSerialPortInfo
from middleware_common import *
from OldMiddleWare import parse_command
import sys
import time
if __name__ == "__main__":
a = QCoreApplication(sys.argv)
serial_port = QSerialPort()
serial_port.setPortName(sys.argv[1])
serial_port.setBaudRate(QSerialPort.Baud9600, QSerialPort.AllDirections)
serial_port.setParity(QSerialPort.NoParity)
serial_port.setStopBits(QSerialPort.OneStop)
serial_port.setDataBits(QSerialPort.Data8)
serial_port.setFlowControl(QSerialPort.NoFlowControl)
serial_port.open(QSerialPort.ReadWrite)
time.sleep(3)
set_profile(serial_port, 1)
# set_date_time(serial_port)
set_wifi(serial_port)
set_end_point(serial_port)
time.sleep(3)
while True:
try:
buffer = serial_port.read(100)
if len(buffer) > 0:
print(buffer, end='')
except Exception as e:
print(e)