本文整理匯總了Python中mraa.Gpio方法的典型用法代碼示例。如果您正苦於以下問題:Python mraa.Gpio方法的具體用法?Python mraa.Gpio怎麽用?Python mraa.Gpio使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mraa
的用法示例。
在下文中一共展示了mraa.Gpio方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import mraa [as 別名]
# 或者: from mraa import Gpio [as 別名]
def __init__(self, pin, position):
self.position = position
self.gpio = mraa.Gpio(pin)
self.gpio.dir(mraa.DIR_OUT)
示例2: __init__
# 需要導入模塊: import mraa [as 別名]
# 或者: from mraa import Gpio [as 別名]
def __init__(self, pin, pull_up=True):
self.pin = pin
self.pull_up = pull_up
self.gpio = mraa.Gpio(pin)
self.gpio.dir(mraa.DIR_IN)
示例3: __init__
# 需要導入模塊: import mraa [as 別名]
# 或者: from mraa import Gpio [as 別名]
def __init__(self, pin, pyfunc, args, pull_up=True):
self.pin = pin
self.pull_up = pull_up
self.gpio = mraa.Gpio(pin)
self.gpio.dir(mraa.DIR_IN)
mode = mraa.EDGE_FALLING if pull_up else mraa.EDGE_RISING
result = self.gpio.isr(mode, pyfunc, args)
if result != mraa.SUCCESS:
raise Exception("I could not configure ISR on pin {0}".format(pin))
示例4: __init__
# 需要導入模塊: import mraa [as 別名]
# 或者: from mraa import Gpio [as 別名]
def __init__(self, pin):
self.gpio = mraa.Gpio(pin)
self.gpio.dir(mraa.DIR_OUT)
示例5: __init__
# 需要導入模塊: import mraa [as 別名]
# 或者: from mraa import Gpio [as 別名]
def __init__(self, sck=15, mosi=17, miso=16, cs=14):
self.sck = mraa.Gpio(sck)
self.mosi = mraa.Gpio(mosi)
self.miso = mraa.Gpio(miso)
self.cs = mraa.Gpio(cs)
self.sck.dir(mraa.DIR_OUT)
self.mosi.dir(mraa.DIR_OUT)
self.miso.dir(mraa.DIR_IN)
self.cs.dir(mraa.DIR_OUT)
self.cs.write(1)
self.frequency(10000000)
self.format(8, 0)
示例6: __init__
# 需要導入模塊: import mraa [as 別名]
# 或者: from mraa import Gpio [as 別名]
def __init__(self):
self.cs0 = m.Gpio(23)
self.cs0.dir(m.DIR_OUT)
self.cs0.write(1)
self.dev = m.spiFromDesc("spi-raw-5-1")
self.dev.frequency(62500)
self.dev.mode(m.SPI_MODE0)
self.dev.bitPerWord(8)
self.timeout = 0
self.rx_buf = []
示例7: reset
# 需要導入模塊: import mraa [as 別名]
# 或者: from mraa import Gpio [as 別名]
def reset(self):
self.RST = m.Gpio(36)
self.RST.dir(m.DIR_OUT)
self.RST.write(0) # reset the device
time.sleep(0.01)
self.RST.write(1) # let the device out of reset
time.sleep(2.01) # wait for the CC1110 to come up
# TODO: change the CC1110 code to not have a 2s delay
示例8: set_data
# 需要導入模塊: import mraa [as 別名]
# 或者: from mraa import Gpio [as 別名]
def set_data(pin, value):
gpio = mraa.Gpio(int(pin))
gpio.dir(mraa.DIR_OUT)
gpio.write(int(value))
return gpio.read()