当前位置: 首页>>代码示例>>Python>>正文


Python GPIO.setSLED方法代码示例

本文整理汇总了Python中GPIO.setSLED方法的典型用法代码示例。如果您正苦于以下问题:Python GPIO.setSLED方法的具体用法?Python GPIO.setSLED怎么用?Python GPIO.setSLED使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GPIO的用法示例。


在下文中一共展示了GPIO.setSLED方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Cellular_LED

# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setSLED [as 别名]
def Cellular_LED(inSLED):
    # This function sets the cellular LED
    #   Arguments:
    #   inStatus : GPS LED status. Pass in either 'ON' or 'OFF'
    #       OFF - LED always OFF
    #       ON - LED function ON
    #
    #   Returns:
    #    0: Pass
    #   -1: Exception
    
    tmpReturn = -1

    try:
        
        #Set Stat LED to default value, 0 for OFF, 2 for ON
        if (inSLED == 'ON'):
            res = GPIO.setSLED(2, 10, 90)
        else:
            res = GPIO.setSLED(0, 10, 90)

        res = ATC.sendAtCmd('AT#SLEDSAV',ATC.properties.CMD_TERMINATOR,0,20)
        if (res == -1): #Errored out, 1 if no error -1 if error
            return tmpReturn
            

        tmpReturn = 0        

    except:
        printException("Cellular_LED")
        JANUS_SER.sendUART("GPS LED exception. \r\n")  


    return tmpReturn
开发者ID:JanusRC,项目名称:Python,代码行数:36,代码来源:JANUS_IO.py

示例2: Cellular_LED

# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setSLED [as 别名]
def Cellular_LED(inSLED):
    # This function sets the cellular LED
    #   Arguments:
    #   inStatus : GPS LED status. Pass in either 'ON' or 'OFF'
    #       OFF - LED always OFF
    #       ON - LED function 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        
        
        #Set Stat LED to default value, 0 for OFF, 2 for ON
        if (inSLED == 'ON'):
            rtnList[1] = GPIO.setSLED(2, 10, 90)
        else:
            rtnList[1] = GPIO.setSLED(0, 10, 90)

        if (rtnList[1] == -1): #Errored out
            return rtnList            

        rtnList = myATC.sendAtCmd('AT#SLEDSAV',myATC.properties.CMD_TERMINATOR,0,20)
        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
开发者ID:JanusRC,项目名称:Python,代码行数:41,代码来源:IO_HE910.py

示例3: init

# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setSLED [as 别名]
def init(inSLED):
    # This function initializes the IO
    #   Arguments:
    #   inSLED : Stat LED. Pass in either 'ON' or 'OFF'
    #       OFF - LED always OFF
    #       ON - LED follows registration status
    #   
    #
    #   Returns:
    #    0: Pass
    #   -1: Exception

    #GPIO Connections:
    #    1 - Do not utilize (Required by GPS)
    #    2 - IGNITION, LOW when ignition is active
    #    3 - N/O Switch, HIGH when the switch is closed
    #    4 - Do not utilize (Required by GPS)
    #    5 - GPS LED (User LED)
    #    6 - Auto ON Control, pulse HIGH to toggle the MCU's operative state. use GPIO1 to verify the state
    #    7 - IIC SDA : Utilizing this as Wake up Event Ignition Flag. Pulled high externally
    #    8 - IIC SCL : Utilizing this as Wake up Event N/O Switch Flag. Pulled high externally
    #    9 - GPIO1 : Utilizing this for Auto-On Verification FROM the MCU, 1 for auto-on enabled, 0 for auto-on disabled
    #    10 - GPIO2 : Utilizing this for Wake up Event verification TO the MCU, 1 if Event has been seen/recorded, otherwise 0.

    
    tmpReturn = -1

    try:
        
        #Set Stat LED to default value, 0 for OFF, 2 for ON
        if (inSLED == 'ON'):
            res = GPIO.setSLED(2, 10, 90)
        else:
            res = GPIO.setSLED(0, 10, 90)

        if (res == -1): #Errored out, 1 if no error -1 if error
            return tmpReturn
        
        #Now set all used GPIO to proper states.
        #GPIO.setIOvalue(GPIOnumber, value)
        #We do not need the above command, setIODir works best for this.
        #GPIO.setIOdir(number, value, direction)
        
        a = GPIO.setIOdir(2, 0, 0)  #Input
        b = GPIO.setIOdir(3, 0, 0)  #Input
        c = GPIO.setIOdir(5, 0, 1)  #Output, LOW (LED OFF)
        d = GPIO.setIOdir(6, 1, 0)  #Output, LOW (Auto-on OFF during INIT, taken care of in the command flow)
        e = GPIO.setIOdir(7, 0, 0)  #Input
        f = GPIO.setIOdir(8, 0, 0)  #Input
        g = GPIO.setIOdir(9, 0, 0)  #Input
        h = GPIO.setIOdir(10, 0, 1)  #Output, LOW (Wake up Event verification default sate, event NOT found)

        if (    a == -1
            or b == -1
            or c == -1
            or d == -1
            or e == -1
            or f == -1
            or g == -1
            or h == -1
            ):
            return tmpReturn    #Errored out, 1 if no error -1 if error
            

        tmpReturn = 0        

    except:
        printException("IO_init")
        JANUS_SER.sendUART("IO Init exception. \r\n")  


    return tmpReturn
开发者ID:JanusRC,项目名称:Python,代码行数:74,代码来源:JANUS_IO.py

示例4:

# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setSLED [as 别名]
## file=blink_led.py, exec=1, start=2

import GPIO

res = GPIO.setSLED(3,50,20)
开发者ID:cybercircuits,项目名称:gmodlab,代码行数:7,代码来源:blink_led.py

示例5: while

# 需要导入模块: import GPIO [as 别名]
# 或者: from GPIO import setSLED [as 别名]
 return frase

try:
    MOD.watchdogEnable(1000)
    salir_prog=0
    #activar SMS AT RUN para telefonos que empiecen por +34:
    res=enviarAT('at+cmgf=1',20,'+CMGF: 1')
    res=enviarAT('at#smsmode=1',30,'OK')
    res=enviarAT('at#smsatwl=0,1,0',"+34*",20,'OK')
    res=enviarAT('at#smsatruncfg=3,1,5',20,'OK')
    res=enviarAT('at#smsatrun=1',30,'OK')
    while (salir_prog==0):
     res = SER.set_speed('9600')
     if (debug==1):
      res=SER.send('\rIniciando programa\r')
     GPIO.setSLED(0, 10, 10)
     linea=GetLineaDesdeSerial(60*20)
     GPIO.setSLED(1, 10, 10)
     IniciarModem()
     GPIO.setSLED(3, 5, 5)
     envio_ok=EnviarDatosMET(CodificarParaGET(linea))
     res=enviarAT('at',10,'OK')
     if (envio_ok==1):
      MOD.watchdogReset()
      if (debug==1):
       res=enviarAT('at#gdatavol=1',10,'#GDATAVOL:')
     if (envio_ok!=1):
      salir_prog=1
      if (debug==1):
       res = SER.send('\r\nFin del programa')
     GPIO.setSLED(3, 10, 10)
开发者ID:jamusategui,项目名称:zjj,代码行数:33,代码来源:3004conSMSATRUN.py


注:本文中的GPIO.setSLED方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。