Get a tap callback in five minutes
One path for Tap Strap and TapXR. Pair the Tap, install Python, connect, and print a finger combination. When you see a tapcode in the terminal, you are done.
| PyPI | |
|---|---|
| Source | TapWithUs/tap-python-sdk |
1. Pair the Tap
Put the Tap Strap or TapXR in pairing mode and pair it in your OS Bluetooth settings (macOS, Windows, or Linux). The SDK does not scan for an unpaired device — it attaches to a Tap the OS already knows.
Hardware help: Tap Strap quick start, TapXR quick start.
2. Install the Python SDK
Python is the fastest first win on a laptop. Requires Python 3.10+. Package name tap-python-sdk, import name tapsdk.
pip install tap-python-sdkMobile or browser stacks later: iOS, Android, Web.
3. Connect
After pairing, await connect() attaches to the Tap. Register callbacks, then await sdk.start() to arm notifications. The full script is in step 4.
4. Print the first tap
Each tap is a combination bitmask 1…31: bit0 = thumb … bit4 = pinky. Example: 5 → 0b00101 → thumb + middle.
Copy this script, run python hello_tap.py, then tap:
import asyncio
from tapsdk import (
DeviceFeatures,
InputModeController,
ModelTypes,
VisionSensorOpModes,
connect,
)
def on_tap(identifier, tapcode):
# tapcode is int 1..31 — bit0=thumb … bit4=pinky
code = tapcode[0] if isinstance(tapcode, (list, tuple)) else tapcode
print(f"{identifier} tapped {code} (0b{int(code):05b})")
async def main():
# Pair in OS Bluetooth settings first — do not expect a cold unpaired scan.
sdk = await connect()
sdk.register_tap_events(on_tap)
await sdk.start()
if hasattr(sdk, "set_input_mode"):
await sdk.set_input_mode(InputModeController())
else:
await sdk.set_feature(DeviceFeatures.MODEL_DETECTION, True)
await sdk.set_vision_sensor_model(ModelTypes.TAPPING)
await sdk.set_vision_sensor_op_mode(VisionSensorOpModes.TRIGGER)
print("Waiting for taps… (Ctrl+C to quit)")
await asyncio.Event().wait()
if __name__ == "__main__":
asyncio.run(main())The script switches the Tap out of keyboard mode for you. If you write your own, do this after start(), or you'll get no tap events.
You should see lines like … tapped 5 (0b00101). That is the first win. Next: How Tap works or the full Python SDK guide.
Browser path: Web SDK.