Skip to main content

A Python library for integrating the TRIKI motion controller (made by Caps Apps) into your projects.

Project description

TRIKI Library

A Python library for the integrating TRIKI motion controller (made by Caps Apps) into your projects.

This library is still in development. Some things may change sligthly.


What is TRIKI?

TRIKI is a Bluetooth Low Energy (BLE) motion controller that has the shape and size of a bottle cap. It is produced by Caps Apps (also known as HOPX) and sold by 'Żabka', a convenience store franchise.

It was designed to be used in mini-games which are on the store's loyalty app.

Why I made this library

I wanted to make this library to give everyone a way to integrate this niche controller into their own games, experiments and other Python projects.

Features

  • Scan for TRIKI controllers
  • Connect to TRIKI controller
  • Get battery level
  • Get FW version
  • Get IMU data from the controller
  • Get state of the built-in button
  • Control built-in LED

Platforms

Platform Does it work?
Windows 10/11 ✅ Tested
macOS ❔ Untested
Linux ⚠️ Partially tested

Linux support needs further testing. Some Arch-based distributions may have issues with receiving data.


Installation

pip install triki-library

Usage

# Import the library
import asyncio
from triki import TRIKIScanner, TRIKIController
# Scan for TRIKI controllers
scanner = TRIKIScanner()
await scanner.scan()
devices = scanner.scanned_devices # Returned as list[TRIKIDevice]

devices[0].name # Get device name
devices[0].address # Get device BT address
# Connect to the controller
controller = TRIKIController("AA:BB:CC:DD:EE:FF")
await controller.connect()
controller.is_connected # Check if device is connected
controller.battery_level # Get battery level
device.firmware_version # Get FW version
controller.spin_x # Get X Spin
controller.spin_y # Get Y Spin
controller.turn_z # Get Z Turn
controller.tilt_x # Get X Tilt
controller.tilt_y # Get Y Tilt
controller.flip_z # Get Z Flip
controller.button_pressed # Check if built-in button is pressed
#turn on LED
await controller.toggle_led(True)

#turn off LED
await controller.toggle_led(False)
# Loop
try:
    while controller.is_connected:
        # Do stuff
finally:
    await controller.disconnect()
# IMPORTANT: disconnect from the controller when you're done with it!
await controller.disconnect()

Examples can be found on the 'examples' directory.


Credits

Library made by Woofter_Wolf

Special thanks to Wojciech "Koksny" Górny for doing the hard work of documenting this device (look here for communication documentation): Link

Copyright

"TRIKI" and "Żabka" are trademarks of Żabka Polska sp. z o.o. "HOPX" is a trademark of Caps Apps sp. z o.o.

This library is an independent, open-source project. It is NOT affiliated, endorsed or sponsored by these companies. This library ships with no software, images or any assets belonging to these companies.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

triki_library-0.1.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

triki_library-0.1.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file triki_library-0.1.1.tar.gz.

File metadata

  • Download URL: triki_library-0.1.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for triki_library-0.1.1.tar.gz
Algorithm Hash digest
SHA256 338e43c63ca45e9ea0043e468181878d0d683b552ab4e9693f861b903cdb196a
MD5 9dfab0d9e374bd94cc6bbd1bc9579be9
BLAKE2b-256 b619064b4fd0ee2e3c754d7b73f9bbe7459d68d9b45656372968cf5ac59f38db

See more details on using hashes here.

File details

Details for the file triki_library-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: triki_library-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for triki_library-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6faccfa30143f36813d4ae8a461101cc9ddbead49a13af3db797817b7d82481d
MD5 e838bdbd2d541b9542a40fc61f46091e
BLAKE2b-256 027dd2495eb9268f42ca9348980d44a5174f8ac5bf2201b48f4cc7f2d1f4f943

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page