本文整理匯總了Python中board.MISO屬性的典型用法代碼示例。如果您正苦於以下問題:Python board.MISO屬性的具體用法?Python board.MISO怎麽用?Python board.MISO使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類board
的用法示例。
在下文中一共展示了board.MISO屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import board [as 別名]
# 或者: from board import MISO [as 別名]
def __init__(self):
Sensor.__init__(self)
self.moisture_min = float(self.config["soil"]["min"])
self.moisture_max = float(self.config["soil"]["max"])
# create SPI bus
spi = busio.SPI(clock=board.SCK, MISO=board.MISO, MOSI=board.MOSI)
# create the cs (chip select)
cs = digitalio.DigitalInOut(board.D8)
# create the mcp object
mcp = MCP.MCP3008(spi, cs)
# create an analog input channel
self.pin = []
self.pin.append(AnalogIn(mcp, MCP.P0))
self.pin.append(AnalogIn(mcp, MCP.P1))
self.pin.append(AnalogIn(mcp, MCP.P2))
self.pin.append(AnalogIn(mcp, MCP.P3))
self.pin.append(AnalogIn(mcp, MCP.P4))
self.pin.append(AnalogIn(mcp, MCP.P5))
self.pin.append(AnalogIn(mcp, MCP.P6))
self.pin.append(AnalogIn(mcp, MCP.P7))
示例2: __init__
# 需要導入模塊: import board [as 別名]
# 或者: from board import MISO [as 別名]
def __init__(self, config: dict, main_thread_running, system_ready):
self.config = config
self.main_thread_running = main_thread_running
self.system_ready = system_ready
self.node_ready = False
spi = busio.SPI(clock=board.SCK, MISO=board.MISO, MOSI=board.MOSI)
cs = digitalio.DigitalInOut(ADCMCP3008Worker.PINS[config['pin']])
self.mcp = MCP.MCP3008(spi, cs)
self.sensors = []
self.init_sensors()
self.node_ready = True