本文来源电子发烧友社区,作者:华仔stm32, 帖子地址:https://bbs.elecfans.com/jishu_2300900_1_1.html
前面获开机获取了基本参数,今天继续完善,这次是手工设定阻值:
Python的代码:
def QrChange(self):
myRvalue = self.ui.lineEdit.text()
try:
if myRvalue != "":
myRvalue = int(myRvalue)
atcmd = "AT+USER.SP=%s" % myRvalue
self.test_at.send_at(atcmd)
mystr = self.test_at.check_at_resp('OK')
if mystr is not None:
pattern = r".=(d+.d+)"
m_list = re.findall(pattern, mystr)
if len(m_list) == 4:
self.ui.label_R.setText("当前设定阻值(SP):%s R" % m_list[0])
self.ui.label_PV.setText("当前电阻输出值(PV):%s" % m_list[1])
except Exception as e:
print("err: %s" % e)
实验现象:
全部0条评论
快来发表一下你的评论吧 !