python蓝牙上位机开发_python做上位机 - osc_2frv0wjp的个人空间 - OSCHINA - 中文开源技术交流社区...
參考文章:
https://blog.csdn.net/dgut_guangdian/article/details/78391270
https://www.cnblogs.com/lanceyu/p/10201236.html
https://blog.csdn.net/absinjun/article/details/81407790
首先安裝pip
你可以通過以下命令來判斷是否已安裝:
pip --version
如果你還未安裝,則可以使用以下方法來安裝:
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py # 下載安裝腳本$ sudo python get-pip.py # 運行安裝腳本
顯示版本和路徑
pip --version
安裝serial、easygui模塊,
windows下需要安裝pyserial,安裝步驟見:
https://learn.adafruit.com/arduino-lesson-17-email-sending-movement-detector/installing-python-and-pyserial
幫助文檔見:
https://pyserial.readthedocs.io/en/latest/shortintro.html
代碼:
import serial
import time
ser = serial.Serial()
ser.baudrate = 9600
ser.port = 'COM3'
print(ser)
ser.open()
print(ser.is_open)
i=1
while(1):
demo=b"1"
ser.write(demo)
s = ser.read(1)
print(s)
time.sleep(0.1)
demo = b"2"
ser.write(demo)
s = ser.read(1)
print(s)
time.sleep(0.1)
繼續。。
總結
以上是生活随笔為你收集整理的python蓝牙上位机开发_python做上位机 - osc_2frv0wjp的个人空间 - OSCHINA - 中文开源技术交流社区...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: jvm内存配置参数_性能测试连载 (23
- 下一篇: websocket python爬虫_p