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


Python GPIO.RPI_INFO属性代码示例

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


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

示例1: index

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import RPI_INFO [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

示例2: ResetIOT_HW

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import RPI_INFO [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

示例3: _get_bus_number

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import RPI_INFO [as 别名]
def _get_bus_number(self):
		pi_type = GPIO.RPI_INFO['TYPE']
		if pi_type in self._BUS_0_TYPES:
			bus_number = 0
		elif pi_type in self._BUS_1_TYPES:
			bus_number = 1
		else:
			raise ValueError('Reading Pi type error, Your Pi "{0}"" is not in the list.\n  Please post an Issus at our Github Page or contract us\n    Github page: https://github.com/sunfounder/Sunfounder_Smart_Video_Car_Kit_for_RaspberryPi/issues\n    Email: support@sunfounder.com\n    SunFounder'.format(pi_type))

		if self._DEBUG:
			print self._DEBUG_INFO, 'Get i2c bus number %d' % bus_number
		return bus_number 
开发者ID:sunfounder,项目名称:SunFounder_SensorKit_for_RPi2,代码行数:14,代码来源:31_bmp280.py

示例4: main

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import RPI_INFO [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

示例5: main

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import RPI_INFO [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.RPI_INFO属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。