当前位置: 首页>>代码示例>>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;未经允许,请勿转载。