当前位置:网站首页>Pyqt5 and communication
Pyqt5 and communication
2022-04-23 09:51:00 【Ximukang】
# import bluetooth
# target_name = "HC-05"
# target_address = None
# nearby_devices = bluetooth.discover_devices(lookup_names=True)
#
# for bdaddr,name in nearby_devices:
# if target_name == name:
#
# target_address = bdaddr
# break
# if target_address is not None:
# print ("found target bluetooth device with address ", target_address)
# else:
# print ("could not find target bluetooth device nearby")
#
# print(target_address)
# sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM )
# sock.connect((target_address, 1))
#
# sock.send("download-app")
# sock.close()
import serial
import time
import _thread # Import thread package
data_ser = serial.Serial("COM7", 9600, timeout=5)
data_ser.flushInput()
def get_data():
while True:
data_count = data_ser.inWaiting()
if data_count != 0:
recv = data_ser.read(data_ser.in_waiting).decode("gbk")
print(time.time(), " --- data_recv --> ", recv)
time.sleep(0.1)
if __name__ == '__main__':
_thread.start_new_thread(get_data, ()) # Open thread , perform get_data Method
while 1:
time.sleep(2)
data_ser.write(b'1') # Send binary 1
time.sleep(2)
print("1211515")
data_ser.write(b'2') # Send binary 0write("1".encode()) # Write a character “1”( perhaps b'1')
self.qwebengine = QWebEngineView(self.centralwidget)
self.qwebengine.setGeometry(QtCore.QRect(10,30,451,321))
self.qwebengine.setAutoFillBackground(False)
self.qwebengine.setStyleSheet("background-color:rgb(170,170,127);")
self.qwebengine.setObjectName("qwebengine")
self.__ui.qwebengine.load(QUrl(r"www.baidu.com"))
self.__ui.qwebengine.load(QUrl(QFileInfo("base.html").absoluteFilePath()))
版权声明
本文为[Ximukang]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230944284668.html
边栏推荐
- JS what is an event? Event three elements and operation elements
- Buuctf [actf2020 freshman competition] include1
- [Niuke practice match 68] fans of Niuniu (matrix fast power cycle matrix optimization)
- Kernel PWN learning (4) -- double fetch & 0ctf2018 baby
- Enter "net start MySQL" and "system error 5. Access denied" appears. Detailed explanation of the problem
- Odoo 服务器搭建备忘
- 最长公共前串
- SAP excel has completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.
- PHP笔记(一):开发环境配置
- Code source daily question div1 (701-707)
猜你喜欢

failureForwardUrl与failureUrl

Set the maximum width of the body, but why does the background color of the body cover the whole page?

JS DOM event

PHP notes (I): development environment configuration

亚马逊云科技入门资源中心,从0到1轻松上云

"Gu Yu series" airdrop

工业元宇宙平台规划与建设

C语言:表达式求值(整型提升、算术转换 ...)

中控学习型红外遥控模块支持网络和串口控制

kernel-pwn学习(4)--Double Fetch&&0CTF2018-baby
随机推荐
NLLLoss+log_ SoftMax=CE_ Loss
Where is int a = 1 stored
1D / 1D dynamic programming learning summary
formatTime时间戳格式转换
PHP notes (I): development environment configuration
Introduction to sap pi / PO login and basic functions
Three challenges that a successful Devops leader should be aware of
MySQL of database -- overview and installation
JS DOM event
Three ways to create objects in JS
Easy to understand subset DP
Simple understanding of arguments in JS
Learn FPGA (from Verilog to HLS)
论文阅读《Integrity Monitoring Techniques for Vision Navigation Systems》
Two methods of building Yum source warehouse locally
Kernel PWN learning (4) -- double fetch & 0ctf2018 baby
1 + X cloud computing intermediate -- script construction, read-write separation
Windows安装redis并将redis设置成服务开机自启
PHP two-dimensional array specifies that the elements are added after they are equal, otherwise new
Example of data object mask used by SAP translate