当前位置:网站首页>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
边栏推荐
- Career planning and implementation in the era of meta universe
- [lnoi2014] LCA - tree chain subdivision - multipoint LCA depth and problems
- 代码源每日一题 div1 (701-707)
- 论文阅读《Integrity Monitoring Techniques for Vision Navigation Systems》——5结果
- ABAP implementation publishes restful services for external invocation example
- 高薪程序员&面试题精讲系列91之Limit 20000加载很慢怎么解决?如何定位慢SQL?
- C language: expression evaluation (integer promotion, arithmetic conversion...)
- Canary publishing using ingress
- php 二维数组指定元素相等后相加否则新增
- Redis exception read error on connection solution
猜你喜欢
Nvidia最新三维重建技术Instant-ngp初探
The sap export excel file opens and shows that the file format and extension of "XXX" do not match. The file may be damaged or unsafe. Do not open it unless you trust its source. Do you still want to
论文阅读《Integrity Monitoring Techniques for Vision Navigation Systems》——3背景
Go language learning notes - slice, map | go language from scratch
JS node operation, why learn node operation
ABAP publishes OData service samples from CDs view
Sql1 [geek challenge 2019]
成功的DevOps Leader 应该清楚的3个挑战
元宇宙时代的职业规划与执行
高薪程序员&面试题精讲系列91之Limit 20000加载很慢怎么解决?如何定位慢SQL?
随机推荐
JS what is an event? Event three elements and operation elements
1 + X cloud computing intermediate -- script construction, read-write separation
打印页面的功能实现
failureForwardUrl与failureUrl
雨生百谷,万物生长
C语言:表达式求值(整型提升、算术转换 ...)
Redis 内存占满导致的 Setnx 命令执行失败
MySQL - Chapter 1 (data types in MySQL)
计算机网络安全实验二|DNS协议漏洞利用实验
SAP CR transmission request sequence and dependency check
Classic routine: DP problem of a kind of string counting
JS node operation, why learn node operation
Interviewer: let's talk about some commonly used PHP functions. Fortunately, I saw this article before the interview
JS case to find the maximum value, reverse the array, bubble sort
Comparison of overloading, rewriting and hiding
Es aggregation aggregation analysis
理解作用域
Nvidia最新三维重建技术Instant-ngp初探
[CF 1425d] danger of mad snakes
Redis 过期 key 清理删除策略汇总