當前位置: 首頁>>代碼示例>>Python>>正文


Python board.I2C屬性代碼示例

本文整理匯總了Python中board.I2C屬性的典型用法代碼示例。如果您正苦於以下問題:Python board.I2C屬性的具體用法?Python board.I2C怎麽用?Python board.I2C使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在board的用法示例。


在下文中一共展示了board.I2C屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import board [as 別名]
# 或者: from board import I2C [as 別名]
def __init__(
        self, *, channels, i2c=None, address=0x40, reference_clock_speed=25000000
    ):
        if channels not in [8, 16]:
            raise ValueError("servo_channels must be 8 or 16!")
        self._items = [None] * channels
        self._channels = channels
        if i2c is None:
            i2c = board.I2C()
        self._pca = PCA9685(
            i2c, address=address, reference_clock_speed=reference_clock_speed
        )
        self._pca.frequency = 50

        self._servo = _Servo(self)
        self._continuous_servo = _ContinuousServo(self) 
開發者ID:adafruit,項目名稱:Adafruit_CircuitPython_ServoKit,代碼行數:18,代碼來源:adafruit_servokit.py

示例2: __init__

# 需要導入模塊: import board [as 別名]
# 或者: from board import I2C [as 別名]
def __init__(self, address=0x60, i2c=None, steppers_microsteps=16):
        self._motor1 = None
        self._motor2 = None
        self._motor3 = None
        self._motor4 = None
        self._stepper1 = None
        self._stepper2 = None
        if i2c is None:
            i2c = board.I2C()
        self._pca = PCA9685(i2c, address=address)
        self._pca.frequency = 1600
        self._steppers_microsteps = steppers_microsteps

    # We can save memory usage (~300 bytes) by deduplicating the construction of the objects for
    # each motor. This saves both code size and the number of raw strings (the error message)
    # stored. The same technique is a net loss for stepper because there is less duplication. 
開發者ID:adafruit,項目名稱:Adafruit_CircuitPython_MotorKit,代碼行數:18,代碼來源:adafruit_motorkit.py

示例3: __init__

# 需要導入模塊: import board [as 別名]
# 或者: from board import I2C [as 別名]
def __init__(self):
        super().__init__()

        i2c = board.I2C()

        if i2c is not None:
            self._accelerometer = adafruit_lsm6ds.LSM6DS33(i2c)

        # NeoPixels
        self._neopixels = neopixel.NeoPixel(
            board.NEOPIXEL, self._neopixel_count, brightness=1, pixel_order=neopixel.GRB
        )

        self._buttons = GamePad(
            digitalio.DigitalInOut(board.BUTTON_A),
            digitalio.DigitalInOut(board.BUTTON_B),
        ) 
開發者ID:adafruit,項目名稱:Adafruit_CircuitPython_PyBadger,代碼行數:19,代碼來源:clue.py

示例4: __init__

# 需要導入模塊: import board [as 別名]
# 或者: from board import I2C [as 別名]
def __init__(self, i2c_bus=board.I2C(), addr=0x2E):
        super(TFTShield18, self).__init__(i2c_bus, addr)
        self.pin_mode(_TFTSHIELD_RESET_PIN, self.OUTPUT)
        self.pin_mode_bulk(self._button_mask, self.INPUT_PULLUP) 
開發者ID:adafruit,項目名稱:Adafruit_CircuitPython_seesaw,代碼行數:6,代碼來源:tftshield18.py

示例5: __init__

# 需要導入模塊: import board [as 別名]
# 或者: from board import I2C [as 別名]
def __init__(self):
        super().__init__()

        i2c = None

        if i2c is None:
            try:
                i2c = board.I2C()
            except RuntimeError:
                self._accelerometer = None

        if i2c is not None:
            int1 = digitalio.DigitalInOut(board.ACCELEROMETER_INTERRUPT)
            try:
                self._accelerometer = adafruit_lis3dh.LIS3DH_I2C(
                    i2c, address=0x19, int1=int1
                )
            except ValueError:
                self._accelerometer = adafruit_lis3dh.LIS3DH_I2C(i2c, int1=int1)

        # NeoPixels
        self._neopixels = neopixel.NeoPixel(
            board.NEOPIXEL, self._neopixel_count, brightness=1, pixel_order=neopixel.GRB
        )

        self._buttons = GamePadShift(
            digitalio.DigitalInOut(board.BUTTON_CLOCK),
            digitalio.DigitalInOut(board.BUTTON_OUT),
            digitalio.DigitalInOut(board.BUTTON_LATCH),
        )

        self._light_sensor = analogio.AnalogIn(board.A7) 
開發者ID:adafruit,項目名稱:Adafruit_CircuitPython_PyBadger,代碼行數:34,代碼來源:pybadge.py

示例6: __init__

# 需要導入模塊: import board [as 別名]
# 或者: from board import I2C [as 別名]
def __init__(self):
        super().__init__()

        i2c = board.I2C()

        int1 = digitalio.DigitalInOut(board.ACCELEROMETER_INTERRUPT)
        try:
            self._accelerometer = adafruit_lis3dh.LIS3DH_I2C(
                i2c, address=0x19, int1=int1
            )
        except ValueError:
            self._accelerometer = adafruit_lis3dh.LIS3DH_I2C(i2c, int1=int1)

        # NeoPixels
        self._neopixels = neopixel.NeoPixel(
            board.NEOPIXEL, self._neopixel_count, brightness=1, pixel_order=neopixel.GRB
        )

        self._buttons = GamePadShift(
            digitalio.DigitalInOut(board.BUTTON_CLOCK),
            digitalio.DigitalInOut(board.BUTTON_OUT),
            digitalio.DigitalInOut(board.BUTTON_LATCH),
        )

        self._pygamer_joystick_x = analogio.AnalogIn(board.JOYSTICK_X)
        self._pygamer_joystick_y = analogio.AnalogIn(board.JOYSTICK_Y)

        self._light_sensor = analogio.AnalogIn(board.A7) 
開發者ID:adafruit,項目名稱:Adafruit_CircuitPython_PyBadger,代碼行數:30,代碼來源:pygamer.py


注:本文中的board.I2C屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。