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


Python GPIO.VERSION属性代码示例

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


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

示例1: displayInfo

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import VERSION [as 别名]
def displayInfo(lcd,ipaddr,mpd_version):
	ver = "version "
	if lcd.getWidth() < 20:
		ver = "ver "
	if len(ipaddr) < 1:
		ipmsg = "No IP network"
	else:
		ipmsg = "IP "+ ipaddr
	radioVersion = "Radio " + ver + radio.getVersion()
	mpdVersion = "MPD " + ver  + mpd_version
	gpioVersion = "GPIO " + ver + GPIO.VERSION

	lcd.line2(radioVersion)
	lcd.line3(mpdVersion)
	lcd.line4(gpioVersion)
	lcd.scroll1(ipmsg, interrupt)
	return

# Check Timer fired 
开发者ID:bobrathbone,项目名称:piradio,代码行数:21,代码来源:radio4.py

示例2: displayInfo

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import VERSION [as 别名]
def displayInfo(lcd,ipaddr,mpd_version):
	ver = "version "
	if lcd.getWidth() < 20:
		ver = "ver "
	if len(ipaddr) < 1:
		ipmsg = "No IP network"
	else:
		ipmsg = "IP "+ ipaddr
	radioVersion = "Radio " + ver + radio.getVersion()
	mpdVersion = "MPD " + ver  + mpd_version
	gpioVersion = "GPIO " + ver + GPIO.VERSION

	lcd.line2(radioVersion)
	lcd.line3(mpdVersion)
	lcd.line4(gpioVersion)
	lcd.scroll1(ipmsg,interrupt)
	return

# Check Timer fired 
开发者ID:bobrathbone,项目名称:piradio,代码行数:21,代码来源:rradiobp4.py

示例3: index

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import VERSION [as 别名]
def index(environ, response):

	modes = {
		-1: "MODE_UNKNOWN",
		10: "BOARD",
		11: "BCM",
		40: "SERIAL",
		41: "SPI",
		42: "I2C",
		43: "PWM"
	}
	
	status = "200 OK"
	
	header = [("Content-Type", "application/json")]
	
	result = {
		"GPIO.RPI_INFO": GPIO.RPI_INFO,
		"GPIO.VERSION": GPIO.VERSION,
		"MODE": modes[ GPIO.getmode() ]
	}
	
	response(status, header)
	
	return [json.dumps(result).encode()] 
开发者ID:victorqribeiro,项目名称:rpiapi,代码行数:27,代码来源:index.py

示例4: ResetIOT_HW

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import VERSION [as 别名]
def ResetIOT_HW(cls, bMode):
        """Set Raspberry pi GPIO pins and reset RF Explorer device

        Parameters: 
            bMode -- True if the baudrate is set to 500000bps, False to 2400bps
        """
        try:
            import RPi.GPIO as GPIO
       
            #print("RPi info: " + str(GPIO.RPI_INFO)) #information about your RPi:
            #print("RPi.GPio version: " + GPIO.VERSION) #version of RPi.GPIO:
            GPIO.setwarnings(False)
            GPIO.setmode(GPIO.BOARD)    #refer to the pin numbers on the P1 header of the Raspberry Pi board
            GPIO.setup(12, GPIO.OUT)    #set /reset (pin 12) to output 
            GPIO.output(12, False)      #set /reset (pin 12) to LOW
            GPIO.setup(21, GPIO.OUT)    #set GPIO2 (pin 21) to output
            GPIO.output(21, bMode)      #set GPIO2 (pin 21) to HIGH (for 500Kbps)
            time.sleep(0.1)             #wait 100ms
            GPIO.output(12, True)       #set /reset to HIGH
            time.sleep(2.5)             #wait 2.5sec
            GPIO.setup(21, GPIO.IN)     #set GPIO2 to input
            GPIO.cleanup()              #clean up GPIO channels 

        except RuntimeError:
            print("Error importing RPi.GPIO!  This is probably because you need superuser privileges.  You can achieve this by using 'sudo' to run your script") 
开发者ID:RFExplorer,项目名称:RFExplorer-for-Python,代码行数:27,代码来源:RFExplorer.py

示例5: displayInfo

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import VERSION [as 别名]
def displayInfo(lcd,ipaddr,mpd_version):
	lcd.line2("Radio version " + radio.getVersion())
	lcd.line3(mpd_version)
	lcd.line4("GPIO version " + GPIO.VERSION)
	if ipaddr is "":
		lcd.line3("No IP network")
	else:
		lcd.scroll1("IP "+ ipaddr,interrupt)
	return

# Check Timer fired 
开发者ID:bobrathbone,项目名称:piradio,代码行数:13,代码来源:radio4x40.py

示例6: initialize

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import VERSION [as 别名]
def initialize(self):
        self._logger.info("Running RPi.GPIO version '{0}'".format(GPIO.VERSION))
        if GPIO.VERSION < "0.6":       # Need at least 0.6 for edge detection
            raise Exception("RPi.GPIO must be greater than 0.6")
        GPIO.setwarnings(False)        # Disable GPIO warnings 
开发者ID:kontakt,项目名称:Octoprint-Filament-Reloaded,代码行数:7,代码来源:__init__.py

示例7: setup

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import VERSION [as 别名]
def setup():
	print "GPIO version: " + str(GPIO.VERSION)
	print "Pi revision " + str(GPIO.RPI_REVISION) 
开发者ID:ARMinARM,项目名称:arminarm,代码行数:5,代码来源:stm32control.py

示例8: on_after_startup

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import VERSION [as 别名]
def on_after_startup(self):
		self._logger.debug(u"LEDStripControl Startup")
		if GPIO:
			self._logger.debug(u"RPi.GPIO version %s" % (GPIO.VERSION,)) 
开发者ID:google,项目名称:OctoPrint-LEDStripControl,代码行数:6,代码来源:__init__.py

示例9: _configure_gpio

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import VERSION [as 别名]
def _configure_gpio(self):
        if not self._hasGPIO:
            self._logger.error("RPi.GPIO is required.")
            return
        
        self._logger.info("Running RPi.GPIO version %s" % GPIO.VERSION)
        if GPIO.VERSION < "0.6":
            self._logger.error("RPi.GPIO version 0.6.0 or greater required.")
        
        GPIO.setwarnings(False)

        for pin in self._configuredGPIOPins:
            self._logger.debug("Cleaning up pin %s" % pin)
            try:
                GPIO.cleanup(self._gpio_get_pin(pin))
            except (RuntimeError, ValueError) as e:
                self._logger.error(e)
        self._configuredGPIOPins = []

        if GPIO.getmode() is None:
            if self.GPIOMode == 'BOARD':
                GPIO.setmode(GPIO.BOARD)
            elif self.GPIOMode == 'BCM':
                GPIO.setmode(GPIO.BCM)
            else:
                return
        
        if self.sensingMethod == 'GPIO':
            self._logger.info("Using GPIO sensing to determine PSU on/off state.")
            self._logger.info("Configuring GPIO for pin %s" % self.senseGPIOPin)

            if self.senseGPIOPinPUD == 'PULL_UP':
                pudsenseGPIOPin = GPIO.PUD_UP
            elif self.senseGPIOPinPUD == 'PULL_DOWN':
                pudsenseGPIOPin = GPIO.PUD_DOWN
            else:
                pudsenseGPIOPin = GPIO.PUD_OFF
    
            try:
                GPIO.setup(self._gpio_get_pin(self.senseGPIOPin), GPIO.IN, pull_up_down=pudsenseGPIOPin)
                self._configuredGPIOPins.append(self.senseGPIOPin)
            except (RuntimeError, ValueError) as e:
                self._logger.error(e)
        
        if self.switchingMethod == 'GPIO':
            self._logger.info("Using GPIO for On/Off")
            self._logger.info("Configuring GPIO for pin %s" % self.onoffGPIOPin)
            try:
                if not self.invertonoffGPIOPin:
                    initial_pin_output=GPIO.LOW
                else:
                    initial_pin_output=GPIO.HIGH
                GPIO.setup(self._gpio_get_pin(self.onoffGPIOPin), GPIO.OUT, initial=initial_pin_output)
                self._configuredGPIOPins.append(self.onoffGPIOPin)
            except (RuntimeError, ValueError) as e:
                self._logger.error(e) 
开发者ID:kantlivelong,项目名称:OctoPrint-PSUControl,代码行数:58,代码来源:__init__.py

示例10: main

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import VERSION [as 别名]
def main():
    import RPi.GPIO as GPIO
    import time

    try:
        print(GPIO.VERSION)
        print(GPIO.RPI_INFO)

        GPIO.setmode(GPIO.BOARD)

        GPIO.setwarnings(False)

        GPIO.setup(12, GPIO.OUT)
        GPIO.setup(11, GPIO.OUT, initial=GPIO.HIGH)
        GPIO.setup(13, GPIO.IN)
        GPIO.setup(15, GPIO.OUT)
        GPIO.setup([16, 18], GPIO.OUT)
        GPIO.setup((8, 10), GPIO.OUT)
        GPIO.setup([21, 19], GPIO.IN)

        GPIO.setup(3, GPIO.IN)
        GPIO.cleanup(3)

        GPIO.setup([5, 7], GPIO.OUT)
        GPIO.cleanup([5, 7])

        GPIO.setup([5, 7], GPIO.IN)
        GPIO.cleanup((5, 7))

        while True:
            GPIO.output(12, GPIO.HIGH)
            GPIO.output(11, 0)
            GPIO.output(15, True)
            GPIO.output([16, 18], not GPIO.input(16))
            GPIO.output((8, 10), [GPIO.HIGH, GPIO.LOW])
            time.sleep(1)

            GPIO.output(12, GPIO.LOW)
            GPIO.output(11, 1)
            GPIO.output(15, False)
            GPIO.output((16, 18), not GPIO.input(16))
            GPIO.output([8, 10], (GPIO.LOW, GPIO.HIGH))
            time.sleep(1)
    finally:
        GPIO.cleanup() 
开发者ID:nosix,项目名称:raspberry-gpio-emulator,代码行数:47,代码来源:sample_board.py

示例11: main

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import VERSION [as 别名]
def main():
    import RPi.GPIO as GPIO
    import time

    try:
        print(GPIO.VERSION)
        print(GPIO.RPI_INFO)

        GPIO.setmode(GPIO.BCM)

        GPIO.setwarnings(False)

        GPIO.setup(18, GPIO.OUT)
        GPIO.setup(17, GPIO.OUT, initial=GPIO.HIGH)
        GPIO.setup(27, GPIO.IN)
        GPIO.setup(22, GPIO.OUT)
        GPIO.setup([23, 24], GPIO.OUT)
        GPIO.setup((14, 15), GPIO.OUT)
        GPIO.setup([9, 10], GPIO.IN)

        GPIO.setup(2, GPIO.IN)
        GPIO.cleanup(2)

        GPIO.setup([3, 4], GPIO.OUT)
        GPIO.cleanup([3, 4])

        GPIO.setup([3, 4], GPIO.IN)
        GPIO.cleanup((3, 4))

        while True:
            GPIO.output(18, GPIO.HIGH)
            GPIO.output(17, 0)
            GPIO.output(22, True)
            GPIO.output([23, 24], not GPIO.input(23))
            GPIO.output((14, 15), [GPIO.HIGH, GPIO.LOW])
            time.sleep(1)

            GPIO.output(18, GPIO.LOW)
            GPIO.output(17, 1)
            GPIO.output(22, False)
            GPIO.output((23, 24), not GPIO.input(23))
            GPIO.output([14, 15], (GPIO.LOW, GPIO.HIGH))
            time.sleep(1)
    finally:
        GPIO.cleanup() 
开发者ID:nosix,项目名称:raspberry-gpio-emulator,代码行数:47,代码来源:sample_bcm.py


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