A package providing convenient access to the Fischertechnik BT-Smart Controller
Project description
- Version:
- 0.1.2 of 2022/12/26
A small library that helps to build simple projects based on the Fischertechnik BT-Smart Controller using Bluetooth LE. The library uses the bleak libray to handle the BLE protocol and asyncio to access device features.
Installation
pip install btsmart
Getting Started
Assume we have attached a Button to the first input of the Controller, as simple lamp to output 1 and a motor element to output 2. Then we can use the library like this
import asyncio
from btsmart import BTSmartController, Button, Dimmer, MotorXM
btn = Button()
dim = Dimmer()
motor = MotorXM()
async def butten_pressed():
print("Button pressed")
await asyncio.gather(
dim.set_level(100),
motor.run_at(speed=150, time=0.5)
)
async def butten_released():
print("Button released")
await dim.set_level(0)
async def main():
btSmart = await BTSmartController.discover()
if btSmart is not None:
await btSmart.connect()
btn.pressed = butten_pressed
btn.released = butten_released
btn.attach(btSmart, 1)
dim.attach(btSmart, 1)
motor.attach(btSmart, 2)
await asyncio.sleep(30)
await btSmart.disconnect()
asyncio.run(main())
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
btsmart-0.1.3.tar.gz
(10.2 kB
view hashes)
Built Distribution
Close
Hashes for btsmart-0.1.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e98c74cd083d74d6c4af4a41d9753f599b11298a41a537f6d1df49a85554d1df |
|
MD5 | d894b34a010690769ae73e3b7c255965 |
|
BLAKE2b-256 | 5a611d6ce8dc897c8c70551556b7583f5967fbc4d6824486ae8d5c1f5bd1f6a4 |