本文整理汇总了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)
示例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.
示例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),
)
示例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)
示例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)
示例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)