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


Python GPIO.LOW属性代码示例

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


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

示例1: writeByte

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import LOW [as 别名]
def writeByte(self, data):
        for i in range(0, 8):
            IO.output(self.__Clkpin, IO.LOW)
            if(data & 0x01):
                IO.output(self.__Datapin, IO.HIGH)
            else:
                IO.output(self.__Datapin, IO.LOW)
            data = data >> 1
            IO.output(self.__Clkpin, IO.HIGH)

        # wait for ACK
        IO.output(self.__Clkpin, IO.LOW)
        IO.output(self.__Datapin, IO.HIGH)
        IO.output(self.__Clkpin, IO.HIGH)
        IO.setup(self.__Datapin, IO.IN)

        while(IO.input(self.__Datapin)):
            sleep(0.001)
            if(IO.input(self.__Datapin)):
                IO.setup(self.__Datapin, IO.OUT)
                IO.output(self.__Datapin, IO.LOW)
                IO.setup(self.__Datapin, IO.IN)
        IO.setup(self.__Datapin, IO.OUT) 
开发者ID:timwaizenegger,项目名称:raspberrypi-examples,代码行数:25,代码来源:tm1637.py

示例2: readUltrasonicSensor

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import LOW [as 别名]
def readUltrasonicSensor():
    GPIO.setup(TRIGGER_PIN, GPIO.OUT)
    GPIO.setup(SENSOR_PIN, GPIO.IN)
    GPIO.output(TRIGGER_PIN, GPIO.LOW)
    time.sleep(0.3)
    GPIO.output(TRIGGER_PIN, True)
    time.sleep(0.00001)
    GPIO.output(TRIGGER_PIN, False)
    while GPIO.input(SENSOR_PIN) == 0:
        signaloff = time.time()
    while GPIO.input(SENSOR_PIN) == 1:
        signalon = time.time()
    timepassed = signalon - signaloff
    distance = timepassed * 17000
    if distance < threshold:
        return 1
    else:
        return 0 
开发者ID:nature1995,项目名称:ran-django-template,代码行数:20,代码来源:controller.py

示例3: __init__

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import LOW [as 别名]
def __init__(self, pins, real_true = GPIO.HIGH):
        '''
        Init the digital display
        :param pin: pin numbers in array
        :param real_true: GPIO.HIGH or GPIO.LOW
        :return: void
        '''
        self.__pins = pins
        self.__real_true = real_true
        try:
            t1 = Thread(target = self.flush_4bit)
            t1.setDaemon(True)
            t1.start()
        except:
            print("Error: Unable to start thread by DigitalDisplay")

    #Stauts. 
开发者ID:spoonysonny,项目名称:SAKS-SDK,代码行数:19,代码来源:digital_display.py

示例4: saks_gpio_init

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import LOW [as 别名]
def saks_gpio_init(self):
        #print 'saks_gpio_init'
        GPIO.setwarnings(False)
        GPIO.cleanup()
        GPIO.setmode(GPIO.BCM)

        GPIO.setup(PINS.BUZZER, GPIO.OUT)
        GPIO.output(PINS.BUZZER, GPIO.HIGH)

        for p in [PINS.IC_TM1637_DI, PINS.IC_TM1637_CLK, PINS.IC_74HC595_DS, PINS.IC_74HC595_SHCP, PINS.IC_74HC595_STCP]:
            GPIO.setup(p, GPIO.OUT)
            GPIO.output(p, GPIO.LOW)

        for p in [PINS.BUZZER, PINS.TACT_RIGHT, PINS.TACT_LEFT, PINS.DIP_SWITCH_1, PINS.DIP_SWITCH_2]:
            GPIO.setup(p, GPIO.OUT)
            GPIO.output(p, GPIO.HIGH)

        for p in [PINS.TACT_RIGHT, PINS.TACT_LEFT, PINS.DIP_SWITCH_1, PINS.DIP_SWITCH_2]:
            GPIO.setup(p, GPIO.IN, pull_up_down = GPIO.PUD_UP) 
开发者ID:spoonysonny,项目名称:SAKS-SDK,代码行数:21,代码来源:sakshat.py

示例5: _shift_write

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import LOW [as 别名]
def _shift_write(self, value):
        """
        Write given value to the shift register

        :param int value: value which you want to write to shift register
        """
        if self._test_shift_pins() is False:
            print("ERROR: PINs for shift register were not set properly.")
            self.__exit__(None, None, None)

        GPIO.output(self._DIR_LATCH, GPIO.LOW)
        for x in range(0, 8):
            temp = value & 0x80
            GPIO.output(self._DIR_CLK, GPIO.LOW)
            if temp == 0x80:
                # data bit HIGH
                GPIO.output(self._DIR_SER, GPIO.HIGH)
            else:
                # data bit LOW
                GPIO.output(self._DIR_SER, GPIO.LOW)
            GPIO.output(self._DIR_CLK, GPIO.HIGH)
            value <<= 0x01  # shift left

        GPIO.output(self._DIR_LATCH, GPIO.HIGH) 
开发者ID:lipoja,项目名称:AMSpi,代码行数:26,代码来源:AMSpi.py

示例6: btn_detect

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import LOW [as 别名]
def btn_detect():
	global btn_status
	with MicrophoneStream(RATE, CHUNK) as stream:
		audio_generator = stream.generator()

		for content in audio_generator:
			GPIO.output(31, GPIO.HIGH)
			rc = ktkws.detect(content)
			rms = audioop.rms(content,2)
			#print('audio rms = %d' % (rms))
			GPIO.output(31, GPIO.LOW)
			if (btn_status == True):
				rc = 1
				btn_status = False			
			if (rc == 1):
				GPIO.output(31, GPIO.HIGH)
				play_file("../data/sample_sound.wav")
				return 200 
开发者ID:gigagenie,项目名称:ai-makers-kit,代码行数:20,代码来源:ex1_kwstest.py

示例7: detect

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import LOW [as 别名]
def detect():
	global button
	with MicrophoneStream(RATE, CHUNK) as stream:
		audio_generator = stream.generator()

		for content in audio_generator:
			#import binascii
			#print ("INBYTE: %s" % (binascii.hexlify(bytearray(content))))
			GPIO.output(31, GPIO.HIGH)
			rc = ktkws.detect(content)
			rms = audioop.rms(content,2)
			#print('audio rms = %d' % (rms))
			GPIO.output(31, GPIO.LOW)
			if (button == True):
				rc = 1
				button = False
			
			if (rc == 1):
				GPIO.output(31, GPIO.HIGH)
				play_file("../data/sample_sound.wav")
				return 200 
开发者ID:gigagenie,项目名称:ai-makers-kit,代码行数:23,代码来源:proj2_yt_mvp.py

示例8: detect

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import LOW [as 别名]
def detect():
	global button
	with MicrophoneStream(RATE, CHUNK) as stream:
		audio_generator = stream.generator()

		for content in audio_generator:
			#import binascii
			#print ("INBYTE: %s" % (binascii.hexlify(bytearray(content))))
			GPIO.output(31, GPIO.HIGH)
			rc = ktkws.detect(content)
			rms = audioop.rms(content,2)
			#print('audio rms = %d' % (rms))
			GPIO.output(31, GPIO.LOW)
			if (button == True):
				rc = 1
				button = False
			
			if (rc == 1):
				GPIO.output(31, GPIO.HIGH)
				gt2vt.play_file("../data/sample_sound.wav")
				return 200 
开发者ID:gigagenie,项目名称:ai-makers-kit,代码行数:23,代码来源:proj3_capital_game.py

示例9: btn_detect

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import LOW [as 别名]
def btn_detect():
	global btn_status
	with MS.MicrophoneStream(RATE, CHUNK) as stream:
		audio_generator = stream.generator()

		for content in audio_generator:
			GPIO.output(31, GPIO.HIGH)
			rc = ktkws.detect(content)
			rms = audioop.rms(content,2)
			#print('audio rms = %d' % (rms))
			GPIO.output(31, GPIO.LOW)
			if (btn_status == True):
				rc = 1
				btn_status = False			
			if (rc == 1):
				GPIO.output(31, GPIO.HIGH)
				MS.play_file("../data/sample_sound.wav")
				return 200 
开发者ID:gigagenie,项目名称:ai-makers-kit,代码行数:20,代码来源:ex1_kwstest.py

示例10: _writeDisplayRam

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import LOW [as 别名]
def _writeDisplayRam(self, xsize, ysize, data):
    if xsize % 8 != 0:
      xsize = xsize + (8 - xsize % 8)
    xsize /= 8

    self._readBusy()
    GPIO.output(DC, GPIO.LOW)
    self._spi.writebytes([0x24])
    GPIO.output(DC, GPIO.HIGH)

    size = int(xsize * ysize)
    if not isinstance(data, list):
      data = [data] * size

    # SPI buffer size default: 4096 bytes
    i = 0
    for i in range(0, int(size/4096)):
      self._spi.writebytes(data[i:i+4096])
      i += 4096
    self._spi.writebytes(data[i:size]) 
开发者ID:oprema,项目名称:Waveshare-E-Ink,代码行数:22,代码来源:epd.py

示例11: _init

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import LOW [as 别名]
def _init(self):
    # Initialize display
    # Reset driver
    GPIO.output(CS, GPIO.LOW)
    GPIO.output(RST, GPIO.HIGH)
    time.sleep(0.1)
    GPIO.output(RST, GPIO.LOW)
    time.sleep(0.01)
    GPIO.output(RST, GPIO.HIGH)

    # Set register
    self._write(gdo_control)  # Pannel configuration, Gate selection
    self._write(soft_start)   # X decrease, Y decrease
    self._write(vcom_vol)     # VCOM setting
    self._write(dummy_line)   # dummy line per gate
    self._write(gate_time)    # Gage time setting
    self._write(ram_data_entry_mode)  # X increase, Y decrease

    # X-source area, Y-gage area
    xdot = self._xDot-1
    ydot = self._yDot-1
    self._setRamArea(0x00, int(xdot/8), ydot%256, int(ydot/256), 0x00, 0x00)
    self._setRamPointer(0x00, ydot%256, int(ydot/256)) # set ram 
开发者ID:oprema,项目名称:Waveshare-E-Ink,代码行数:25,代码来源:epd.py

示例12: start

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import LOW [as 别名]
def start(self):
        """send start signal to TM1637"""
        IO.output(self.__Clkpin, IO.HIGH)
        IO.output(self.__Datapin, IO.HIGH)
        IO.output(self.__Datapin, IO.LOW)
        IO.output(self.__Clkpin, IO.LOW) 
开发者ID:timwaizenegger,项目名称:raspberrypi-examples,代码行数:8,代码来源:tm1637.py

示例13: stop

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import LOW [as 别名]
def stop(self):
        IO.output(self.__Clkpin, IO.LOW)
        IO.output(self.__Datapin, IO.LOW)
        IO.output(self.__Clkpin, IO.HIGH)
        IO.output(self.__Datapin, IO.HIGH) 
开发者ID:timwaizenegger,项目名称:raspberrypi-examples,代码行数:7,代码来源:tm1637.py

示例14: read_data

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import LOW [as 别名]
def read_data(pin):
    data = 0
    for i in range(8):
        if (GPIO.input(pin) == GPIO.LOW):
            while (GPIO.input(pin) == GPIO.LOW): # wait for 50us
                pass
            time.sleep(30 * 1e-6) # determine the duration of the high level to determine the data is '0 'or '1'
            if (GPIO.input(pin) == GPIO.HIGH):
                data |= (1 << (7-i)) # high front and low in the post
            while (GPIO.input(pin) == GPIO.HIGH): # data '1 ', wait for the next one receiver
                pass
    return data 
开发者ID:timwaizenegger,项目名称:raspberrypi-examples,代码行数:14,代码来源:ky015.py

示例15: LED_turn_on

# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import LOW [as 别名]
def LED_turn_on():
    GPIO.output(37, GPIO.LOW)
    print("LED turn on") 
开发者ID:zyzisyz,项目名称:RPI_web_remote_control,代码行数:5,代码来源:rpi_control.py


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