本文整理汇总了Python中board.TX属性的典型用法代码示例。如果您正苦于以下问题:Python board.TX属性的具体用法?Python board.TX怎么用?Python board.TX使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类board
的用法示例。
在下文中一共展示了board.TX属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: touch_TX
# 需要导入模块: import board [as 别名]
# 或者: from board import TX [as 别名]
def touch_TX(self): # pylint: disable=invalid-name
"""Detect touch on capacitive touch pad TX (also known as A7 on the Circuit Playground
Express) Note: can be called as ``touch_A7`` on Circuit Playground Express.
.. image :: ../docs/_static/capacitive_touch_pad_A7.jpg
:alt: Capacitive touch pad TX
To use with the Circuit Playground Express or Bluefruit:
.. code-block:: python
from adafruit_circuitplayground import cp
while True:
if cp.touch_A7:
print('Touched pad A7')
"""
return self._touch(7)
开发者ID:adafruit,项目名称:Adafruit_CircuitPython_CircuitPlayground,代码行数:20,代码来源:circuit_playground_base.py
示例2: __init__
# 需要导入模块: import board [as 别名]
# 或者: from board import TX [as 别名]
def __init__(self):
self._a = digitalio.DigitalInOut(board.BUTTON_A)
self._a.switch_to_input(pull=digitalio.Pull.DOWN)
self._b = digitalio.DigitalInOut(board.BUTTON_B)
self._b.switch_to_input(pull=digitalio.Pull.DOWN)
self.gamepad = gamepad.GamePad(self._a, self._b)
# Define switch:
self._switch = digitalio.DigitalInOut(board.SLIDE_SWITCH)
self._switch.switch_to_input(pull=digitalio.Pull.UP)
# Define LEDs:
self._led = digitalio.DigitalInOut(board.D13)
self._led.switch_to_output()
self._pixels = neopixel.NeoPixel(board.NEOPIXEL, 10)
# Define sensors:
self._temp = adafruit_thermistor.Thermistor(
board.TEMPERATURE, 10000, 10000, 25, 3950
)
self._light = Photocell(board.LIGHT)
# Define touch:
# Initially, self._touches stores the pin used for a particular touch. When that touch is
# used for the first time, the pin is replaced with the corresponding TouchIn object.
# This saves a little RAM over using a separate read-only pin tuple.
# For example, after `cp.touch_A2`, self._touches is equivalent to:
# [None, board.A1, touchio.TouchIn(board.A2), board.A3, ...]
# Slot 0 is not used (A0 is not allowed as a touch pin).
self._touches = [
None,
board.A1,
board.A2,
board.A3,
board.A4,
board.A5,
board.A6,
board.TX,
]
self._touch_threshold_adjustment = 0
# Define acceleration:
self._i2c = busio.I2C(board.ACCELEROMETER_SCL, board.ACCELEROMETER_SDA)
self._int1 = digitalio.DigitalInOut(board.ACCELEROMETER_INTERRUPT)
self._lis3dh = adafruit_lis3dh.LIS3DH_I2C(
self._i2c, address=0x19, int1=self._int1
)
self._lis3dh.range = adafruit_lis3dh.RANGE_8_G
# Define audio:
self._speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
self._speaker_enable.switch_to_output(value=False)
self._sample = None
self._sine_wave = None
self._sine_wave_sample = None
# Initialise tap:
self._detect_taps = 1
self.detect_taps = 1
开发者ID:adafruit,项目名称:Adafruit_CircuitPython_CircuitPlayground,代码行数:61,代码来源:circuit_playground_base.py