Skip to main content

Python library for the AkaDako board (TFabWorks)

Project description

akadako (Python)

フィジカルコンピューティングデバイス AkaDako(TFabWorks)を Python から制御するためのライブラリです。 公式 JavaScript ライブラリ akadako.js と同じ API 設計を Python に移植しています。

インストール

pip install akadako

ネットワーク通信(共有サーバ)機能も使う場合:

pip install "akadako[share]"

ボードとの接続には python-rtmidi を使用します(依存に含まれます)。

クイックスタート

本ライブラリは同期(ブロッキング)API です。akadako.jsasync/await 中心ですが、これはブラウザにブロッキング I/O が無いための制約で、Python ではその必要がありません。gpiozero などの Python フィジカルコンピューティング系ライブラリと同じく、await 無しでそのまま呼び出せます。

import time
from akadako import AkaDako

board = AkaDako.connect()                 # 接続(ブロッキング)
board.on_disconnected(lambda: print("切断されました"))
try:
    while board.is_connected:
        print("温度:", board.fetch_temperature())
        print("明るさ:", board.fetch_brightness())
        time.sleep(0.1)                   # 負荷軽減
finally:
    board.disconnect()

JavaScript との対応

akadako.jscamelCase メソッドは Python では snake_case になります(例: fetchTemperature()fetch_temperature()runServoTurn()run_servo_turn())。

列挙・値クラス・エラーは akadako.js と同じく AkaDako のメンバーとしても参照できます。from akadako import AkaDako だけで一通り使えます(個別に from akadako import ServoWrite, Color のように import することも可能)。

from akadako import AkaDako

board = AkaDako.connect()
board.run_servo_turn(AkaDako.ServoWrite.A1, 50, 90)
board.run_color_led_fill_color(AkaDako.ColorLed.A1, AkaDako.Color.RED)

利用できるメンバー: DigitalRead / DigitalReadPin / DigitalWrite / AnalogRead / ServoWrite / PwmWrite / ColorLed / IrRemoteWrite / PinBias / Color / Rainbow、および各種エラー(NotSupportedError など)。

詳細はマニュアルを参照してください。

ライセンス

MIT License

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

akadako-0.4.0.tar.gz (33.1 kB view details)

Uploaded Source

Built Distribution

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

akadako-0.4.0-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

File details

Details for the file akadako-0.4.0.tar.gz.

File metadata

  • Download URL: akadako-0.4.0.tar.gz
  • Upload date:
  • Size: 33.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for akadako-0.4.0.tar.gz
Algorithm Hash digest
SHA256 2040aff96c3fe1a11f81d64c2efb892fc430b1a7c72f98ac2c55c7e25c877465
MD5 87016e8f830839bcfab88812b20fc843
BLAKE2b-256 701a9a5209041ac7ba1d2ac0a1cd35853d70e43f162d623da95256949f655ee0

See more details on using hashes here.

File details

Details for the file akadako-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: akadako-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 35.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for akadako-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a61bbe584506ed6a032d68916e191e0546bdbfb07eb02d64d0dc197fbf630b3
MD5 24f38a5254dc007efbda13d6ac8bd0dc
BLAKE2b-256 4864a00bb5d1be5930c3c356cc0364777609cf1bb190f9763b2bbe2ab65d05d7

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