Getting started (v1)¶
This tutorial walks you through installing the SDK, connecting with TapSDK, and printing tap events. By the end you will have a small asyncio program that talks to a classic-protocol Tap.
What you need¶
- Python 3.10 or newer
- A Tap Strap, Tap Strap 2, or TapXR on v1 firmware (no framed
c3ff000echaracteristic)
If connect() returns TapSDK2, use the v2 tutorial instead.
1. Install the SDK¶
On Linux, also install BlueZ tooling and add your user to the bluetooth group:
2. Create a project file¶
Create hello_tap.py:
import asyncio
from tapsdk import InputModeController, TapSDK, connect
def on_tap(identifier, tapcode):
print(f"{identifier} tapped {tapcode}")
def on_connect(sdk):
print("Connected:", sdk)
async def main():
sdk = await connect()
assert isinstance(sdk, TapSDK), "Expected v1 TapSDK — this device is v2"
sdk.register_connection_events(on_connect)
sdk.register_tap_events(on_tap)
await sdk.start()
await sdk.set_input_mode(InputModeController())
await asyncio.Event().wait()
asyncio.run(main())
Or construct TapSDK() and call await tap.run() when you already know the firmware is v1.
3. Run it¶
- Turn the Tap on.
- Run:
- When you see
Connected: …, tap with one or more fingers. You should see lines like:
tapcode is an int finger bitmask (bit 0 = thumb … bit 4 = pinky); 5 means thumb + middle. See Events.
Without Controller (or Controller+Text) mode, Text-mode devices stay silent for SDK tap events.
4. What just happened¶
await connect()attaches to a Tap (already connected, or by scan), detects protocol, and returnsTapSDKfor v1. Notifications are not started yet.register_*attaches callbacks (sync; register connection callbacks beforestart()).await sdk.start()arms GATT notifications and fires the connection callback with the SDK instance.set_input_mode(InputModeController())enables app-bound tap delivery.
Next steps¶
- Switch modes, stream sensors, or send haptics: How-to guides
- Full callback and command signatures: API reference
- Why modes and sensors are designed this way: Explanation
- Explicit v1 sample:
examples/basic.py