本文整理汇总了Python中RPi.GPIO.HIGH属性的典型用法代码示例。如果您正苦于以下问题:Python GPIO.HIGH属性的具体用法?Python GPIO.HIGH怎么用?Python GPIO.HIGH使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类RPi.GPIO
的用法示例。
在下文中一共展示了GPIO.HIGH属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: writeByte
# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import HIGH [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)
示例2: __init__
# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import HIGH [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.
示例3: saks_gpio_init
# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import HIGH [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)
示例4: _shift_write
# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import HIGH [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)
示例5: btn_detect
# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import HIGH [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
示例6: detect
# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import HIGH [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
示例7: detect
# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import HIGH [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
示例8: btn_detect
# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import HIGH [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
示例9: _writeDisplayRam
# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import HIGH [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])
示例10: _init
# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import HIGH [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
示例11: start
# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import HIGH [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)
示例12: stop
# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import HIGH [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)
示例13: eventTrack
# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import HIGH [as 别名]
def eventTrack(e):
print("Tracked!")
while(GPIO.input(e) == GPIO.HIGH): # waits until signal is off
pass
示例14: read_data
# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import HIGH [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
示例15: LED_turn_off
# 需要导入模块: from RPi import GPIO [as 别名]
# 或者: from RPi.GPIO import HIGH [as 别名]
def LED_turn_off():
GPIO.output(37, GPIO.HIGH)
print("LED turn off")