本文整理汇总了Python中GPIO.setIOvalue方法的典型用法代码示例。如果您正苦于以下问题:Python GPIO.setIOvalue方法的具体用法?Python GPIO.setIOvalue怎么用?Python GPIO.setIOvalue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GPIO
的用法示例。
在下文中一共展示了GPIO.setIOvalue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: stopEngine
# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setIOvalue [as 别名]
def stopEngine(sms):
Helper.writeLog('#Begin: StopEngine function')
Helper.writeLog('-Password in sms is '+sms.password)
if Password == SavedPassword and SavedPassword != 0 :
Helper.writeLog('-In Stop engine Condition')
GPSLat = getGPSLocation('Lat')
Helper.writeLog('-Latitude= '+GPSLat)
GPSLon = getGPSLocation('Lon')
Helper.writeLog('-Longitude= '+GPSLon)
Number = sms.number
GPIO.setIOvalue(8,0)
Helper.writeLog('-Before Sending the SMS')
SMSHandler.sendSMS(Number,'Your car was last seen in this location http://maps.google.com/?q='+GPSLat.rstrip().lstrip()+','+GPSLon.rstrip().lstrip())
Helper.writeLog('-Deleting SMS')
SMSHandler.deleteSMS(MessageIndex,'STP')
else :
Helper.writeLog('Deleting SMS')
SMSHandler.deleteSMS(MessageIndex,'STP 2')
示例2: setSIMSELECT
# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setIOvalue [as 别名]
def setSIMSELECT(state):
"""Установка состояния выхода SIMSELECT
Args:
state: требуемое состояние
"""
GPIO.setIOvalue(5, state)
示例3: setOUT2
# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setIOvalue [as 别名]
def setOUT2(state):
"""Установка состояния реле 2
Args:
state: требуемое состояние
"""
GPIO.setIOvalue(1, state)
示例4: feed
# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setIOvalue [as 别名]
def feed():
b = GPIO.setIOvalue(11, 0)
b = GPIO.setIOvalue(12, 0)
MOD.sleep(10)
b = GPIO.setIOvalue(11, 1)
b = GPIO.setIOvalue(12, 1)
msg = "Reseting External Watchdog"
# Log.appendLog(msg)
return 1
示例5: SW_IGN_Status
# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setIOvalue [as 别名]
def SW_IGN_Status():
# This function reads the status of the event triggers, then toggles GPIO2 in response to signal the MCU that we received the information.
# We are reading the MCU's signaling because it can poll and latch the states more accurately than directly reading in the python flow.
# This allows less errors when reading the states in real time as well as catching a wake up event.
# Arguments:
# none
#
# Returns:
# 0: Pass, Switch is triggered
# 1: Pass, Ignition is triggered
# 2: Pass, BOTH are triggered
# -1: Exception
# -2: Pass, Neither is triggered
tmpReturn = -1
try:
#GPIO.getIOvalue(GPIOnumber)
# 7 - IIC SDA/IGNITION : Utilizing this as Event Ignition Flag, active LOW
# 8 - IIC SCL/SWITCH : Utilizing this as Event N/O Switch Flag, active LOW
#GPIO.setIOvalue(GPIOnumber, value)
# 10 - GPIO2 : Utilizing this as the event received verification, active HIGH
IgnRead = GPIO.getIOvalue(7)
SwitchRead = GPIO.getIOvalue(8)
if (IgnRead == 0 and SwitchRead == 1): #Ignition Active, based on signal from MCU
res = GPIO.setIOvalue(10, 1)
tmpReturn = 1
elif (IgnRead == 1 and SwitchRead == 0): #Switch Active, based on signal from MCU
res = GPIO.setIOvalue(10, 1)
tmpReturn = 0
elif (IgnRead == 0 and SwitchRead == 0): #Both Active, based on signal from MCU
res = GPIO.setIOvalue(10, 1)
tmpReturn = 2
elif (IgnRead == 1 and SwitchRead == 1): #Neither Active, based on signal from MCU
tmpReturn = -2
if (tmpReturn != -1):
res = GPIO.setIOvalue(10, 0) #Reset the GPIO signaling
except:
printException("SW_IGN Exception")
JANUS_SER.sendUART("SW_IGN Exception \r\n")
#Return value of GPIO get
return tmpReturn
示例6: send_DB9
# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setIOvalue [as 别名]
def send_DB9(inSTR):
# This function sends data via External DB9 Serial Port
try:
GPIO.setIOvalue(20, 1) #Set MUX SELECT, GPIO 20 value is Set to '1'
res = SER.send(str(inSTR))
except:
print 'Script encountered an exception.'
print 'Exception Type: ' + str(sys.exc_type)
print 'MODULE -> GSM864QP_SER'
print 'METHOD -> send_DB9()'
return(res)
示例7: read_50PIN
# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setIOvalue [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)
示例8: GPS_LED
# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setIOvalue [as 别名]
def GPS_LED(inStatus, inActive):
# This function initializes the IO
# Arguments:
# inStatus : GPS LED status. Pass in either 'ON' or 'OFF'
# OFF - LED always OFF
# ON - LED always ON
# inActive : GPS LED Usage. Pass in either 'ON' or 'OFF'
# OFF - LED is not used, ignore LED commands
# ON - LED is used, allow LED commands
#
# Returns:
# 0: Pass
# -1: Exception
if (inActive == 'OFF'): #We are not using the LED, permanently turn it off and return as passing
res = GPIO.setIOvalue(5, 0)
return 0
tmpReturn = -1
try:
#GPIO.setIOvalue(GPIOnumber, value)
# 5 - GPS LED (User LED)
if (inStatus == 'OFF'):
res = GPIO.setIOvalue(5, 0)
elif (inStatus == 'ON'):
res = GPIO.setIOvalue(5, 1)
if (res == -1):
return tmpReturn #Errored out, 1 if no error -1 if error
tmpReturn = 0
except:
printException("GPS_LED")
JANUS_SER.sendUART("GPS LED exception. \r\n")
return tmpReturn
示例9: initGPS
# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setIOvalue [as 别名]
def initGPS (speed,format):
try:
#GPS RESET, GPIO 18 configured as Output, value is Cleared to '0'
#GPS held in RESET
GPIO.setIOdir(18,1,1)
#GPS RESET, GPIO 18 configured as Output, value is Cleared to '0'
#GPS is running
GPIO.setIOvalue(18, 0)
#Init Serial Port Settings
res = GSM864QP_SER.init_parameters(speed,format)
MOD.sleep(10)
res = GSM864QP_SER.send_50PIN('\r\n')
#Disable all NMEA output sentences
#NMEA GPS sentences will only transmit when polled by CW20.update() method
res = GSM864QP_SER.send_50PIN('$PNMRX103,ALL,0\r\n')
## Start timeout timer
CW20_timerA = timers.timer(0)
CW20_timerA.start(2)
# Empty Serial Port Buffer
res = "junk"
while(res != ""):
res = GSM864QP_SER.read_50PIN()
if (CW20_timerA.isexpired()):
break
except:
print 'Script encountered an exception.'
print 'Exception Type: ' + str(sys.exc_type)
print 'MODULE -> CW20'
print 'METHOD -> initGPS(' + speed + ',' + format + ')'
return
示例10: USER_LED
# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setIOvalue [as 别名]
def USER_LED(inStatus):
# This function initializes the IO
# Arguments:
# inStatus : GPS LED status. Pass in either 'ON' or 'OFF'
# OFF - LED always OFF
# ON - LED always ON
#
try:
rtnList = [-1,-1] #[return status,return data]
# return status:
# -1: Exception occurred
# 0: No errors occurred, no return data
# 1: No errors occurred, return data
#GPIO.setIOvalue(GPIOnumber, value)
# 2 - GPS LED (User LED)
if (inStatus == 'OFF'):
rtnList[1] = GPIO.setIOvalue(2, 0) #Output, LOW (LED OFF)
elif (inStatus == 'ON'):
rtnList[1] = GPIO.setIOvalue(2, 1) #Output, HIGH (LED ON)
if (rtnList[1] == -1): #Errored out
return rtnList
rtnList[0] = 0 #no error, no data
except:
print sys.exc_info()
rtnList[0] = -1
return rtnList
示例11: startEngine
# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setIOvalue [as 别名]
def startEngine(sms):
Helper.writeLog('#Begin: StartEngine function')
Helper.writeLog('-Password in sms is '+sms.password)
if Password == SavedPassword and SavedPassword != 0 :
Helper.writeLog('-In Start engine Condition')
GPSLat = getGPSLocation('Lat')
Helper.writeLog('-Latitude= '+GPSLat)
GPSLon = getGPSLocation('Lon')
Helper.writeLog('-Longitude= '+GPSLon)
GPIO.setIOvalue(8,1)
Helper.writeLog('-Before Sending the SMS')
SMSHandler.sendSMS(Number,'Your car now is ready to start at this location http://maps.google.com/?q='+GPSLat.rstrip().lstrip()+','+GPSLon.rstrip().lstrip())
Helper.writeLog('-Deleting SMS')
SMSHandler.deleteSMS(MessageIndex,'STRT')
else :
Helper.writeLog('-Deleting SMS')
SMSHandler.deleteSMS(MessageIndex,'STRT 2')
示例12: range
# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setIOvalue [as 别名]
# Further modified by: #
# Lucas Vickars #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# with this program. If not, see <http://www.gnu.org/licenses/>. #
#########################################################################
import sout
import GPIO
import MOD
print "gpio test"
for i in range(10):
GPIO.setIOvalue(12, 1)
print "on"
MOD.sleep(10)
GPIO.setIOvalue(12,0)
print "off"
MOD.sleep(10)
示例13:
# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setIOvalue [as 别名]
import GPIO
import MOD
i = 0
while i < 100:
GPIO.setIOvalue(7, 1)
MOD.sleep(10)
GPIO.setIOvalue(7, 0)
MOD.sleep(10)
i = i + 1
示例14: led_blink
# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setIOvalue [as 别名]
def led_blink( count ): #debug function
for _ in range(count):
GPIO.setIOvalue(7,1)
MOD.sleep(3)
GPIO.setIOvalue(7,0)
MOD.sleep(3)
示例15: turnOnSim2
# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setIOvalue [as 别名]
def turnOnSim2():
GPIO.setIOvalue(5, 1)