本文整理汇总了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()