本文整理汇总了Python中SER.receive方法的典型用法代码示例。如果您正苦于以下问题:Python SER.receive方法的具体用法?Python SER.receive怎么用?Python SER.receive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SER
的用法示例。
在下文中一共展示了SER.receive方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_LockFlag
# 需要导入模块: import SER [as 别名]
# 或者: from SER import receive [as 别名]
def check_LockFlag():
#unlocked returns 1
res = SER.receive(15)
res = SER.send('GET_LOCK_FLAG\r')
res = SER.receive(15)
if(res.find('UNLOCKED' != -1)):
res = 1
# locked returns 0
else:
res = 0
return res
示例2: check_PannicFlag
# 需要导入模块: import SER [as 别名]
# 或者: from SER import receive [as 别名]
def check_PannicFlag():
res = SER.receive(15)
res = SER.send('GET_PANNIC_STATUS\r')
res = SER.receivebyte(20)
if(res == 97):
print
#nopannic returns 1
res = 1
#pannic returns 0
else:
res = 0
return res
示例3: check_serial
# 需要导入模块: import SER [as 别名]
# 或者: from SER import receive [as 别名]
def check_serial(f, buffer):
# Wait for serial input
data = SER.receive(1)
if data:
# Echo it
SER.send(data)
# Add it to the buffer
buffer = buffer + data
# If the message's done send it
end_index = buffer.find('\r')
if end_index > -1:
message = buffer[:end_index + 1]
buffer = buffer[end_index + 1:]
f(message)
return buffer
示例4: read_50PIN
# 需要导入模块: import SER [as 别名]
# 或者: from SER import receive [as 别名]
def read_50PIN():
# This function receives data via External 50 pin Header Serial Port
try:
GPIO.setIOvalue(20, 0) #Set MUX SELECT, GPIO 20 value is Set to '0'
res = SER.receive(10)
except:
print 'Script encountered an exception.'
print 'Exception Type: ' + str(sys.exc_type)
print 'MODULE -> GSM864QP_SER'
print 'METHOD -> read_50PIN()'
return(res)
示例5: reset_PannicFlag
# 需要导入模块: import SER [as 别名]
# 或者: from SER import receive [as 别名]
def reset_PannicFlag():
res = SER.receive(15)
res = SER.send('RESET_PANNIC_STATUS\r')
res = SER.receive(15)
return 1
示例6: reset_LockFlag
# 需要导入模块: import SER [as 别名]
# 或者: from SER import receive [as 别名]
def reset_LockFlag():
res = SER.receive(15)
res = SER.send('RESET_LOCK_FLAG\r')
res = SER.receive(15)
return 1
示例7: str
# 需要导入模块: import SER [as 别名]
# 或者: from SER import receive [as 别名]
a = SER.send('\r\n***************************************************************************\r\n')
a = SER.send('\r\n- wait for connection to network ----------------\r\n')
r = FUNC.openGPRS(conf['PIN_SIM'],conf['APN'],conf['GPRS_USER'],conf['GPRS_PASS']) #openGPRS(P,A,GU,GP)
a = FUNC.setGPIO(CONFIG.statLED,1)
a = SER.send('\r\n\r\n- wait for data input ----------------\r\n')
# start Schleife --------------------------------------------------------
while 1:
a = FUNC.setGPIO(CONFIG.statLED,0)
MOD.sleep(10)
a = FUNC.setGPIO(CONFIG.statLED,1)
MOD.sleep(10)
b = SER.send('\r\nYou have 10 seconds to put something in.\r\n')
MOD.sleep(10)
res = SER.receive(100)
MOD.sleep(10)
if ( res != '' ):
data = conf['PREF'] + '=' + str(res)
MOD.sleep(10)
lang = len(data)
r = FUNC.sendData(conf['PIN_SIM'],conf['POST'],conf['HOST'],conf['APN'],conf['GPRS_USER'],conf['GPRS_PASS'],data,lang)
a = SER.send('\r\n\r\n***************************************************************************')
a = SER.send('\r\n* END of script *')
a = SER.send('\r\n***************************************************************************\r\n')