CreaTeBME
Python Package for interfacing the bluetooth IMU module for CreaTe M8 BME.
Installation
To install the latest stable version simply run this in your terminal. If you are using PyCharm then you can open the terminal on the bottom left of the screen.
pip install CreaTeBME
Example
A simple example to connect to a sensor and read and print the data indefinitely. The package automatically connects to the device, so you do not have to connect to it manually.
from CreaTeBME import SensorManager
# Create a sensor manager for the given sensor names using the given callback
manager = SensorManager(['0BE6'])
# Start the sensor manager
manager.start()
while True:
measurements = manager.get_measurements()
for sensor, data in measurements.items():
if len(data) > 0:
print(sensor, data)
# Stop the sensor manager
manager.stop()
Usage
SensorManager (asyncio wrapper)
This package uses Bleak for the bluetooth communication. Bleak uses asyncio, thus this package has to use this too. To ease usage, a wrapper has been made for people not experienced with asyncio. This wrapper also automates the connection of the sensors over bluetooth.
To connect to the sensors, simply initialize a SensorManager object with the sensor names.
from CreaTeBME import SensorManager
manager = SensorManager(['A1B2', 'C3D4'])
Then start reading data from the sensors by calling the start method of the SensorManager.
manager.start()
To get the IMU measurements the `get_measurements()' method can be used. This returns the measurements received since the last time this method was called.
measurements = manager.get_measurements()
The data returned by this method is a dictionary containing a list for each sensor with the received measurements. A single measurement is a list of 6 floats. The measurements are structured like this
- [0:2] = x,y,z of accelerometer in (g).
- [3:5] = x,y,z of gyroscope in (deg/s).
Finally, make sure to also call the stop method when exiting your program.
manager.stop()
Manual Connection
⚠️Understanding of asyncio required⚠️
Another way of connecting IMU sensors is to manually create ImuSensor objects.
This can be done by specifying the BLE device that should be connected as a sensor.
from CreaTeBME import ImuSensor
sensor = ImuSensor(device)
The device has to be a Bleak BLEDevice object that can be acquired using the discover method of BleakScanner.
from bleak import BleakScanner
from CreaTeBME import ImuSensor
async def connect():
devices = await BleakScanner.discover(return_adv=True)
sensor = ImuSensor(devices[0])
API reference
For the API reference look here
Metadata
Release files for CreaTeBME 1.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| createbme-1.2.3.tar.gz | 19.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| CreaTeBME-1.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.3 kB
Release files / createbme-1.2.3.tar.gz
| Download URL | createbme-1.2.3.tar.gz |
|---|---|
| Size | 19.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
376b75857355266e0700e203fd6bc03e099ab13ec648b763ddc82892dd237b93
|
|
BLAKE2b-256 checksum How to use checksums |
e4a624cf1ec890de1c91efefc85aa9dcc1d2767397fc35a0a40c30956a14a69c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / CreaTeBME-1.2.3-py3-none-any.whl
| Download URL | CreaTeBME-1.2.3-py3-none-any.whl |
|---|---|
| Size | 20.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
19afb8876207bcc6ba7697a07f0498150d34189b70a0eab033afa4494507d872
|
|
BLAKE2b-256 checksum How to use checksums |
25ffafdb5234abd3c085126b5cce7b000e865d6166725fdc6ae14851bd9999cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Security for CreaTeBME 1.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.