Python Package for interfacing the bluetooth IMU module for CreaTe M8 BME.
Project description
CreaTeBME
Python Package for interfacing the bluetooth IMU module for CreaTe M8 BME.
Installation
To install the latest stable version simply run pip install CreaTeBME
.
Usage
Easy Wireless
To connect to the sensors, a simple call of the connect()
method can be used. This method will return a list of ImuSensor
objects.
from CreaTeBME import connect
sensors = connect()
The take_mesurement()
method of the ImuSensor objects can in return be used to read out the gyroscope and accelerometer data.
while True:
for sensor in sensors:
measurement = sensor.take_measurement()
# Do something with the data
This will return a list of the accelerometer and gyroscope data in the form [acc_x, acc_y, acc_z, gyr_x, gyr_y, gyr_z]
. The accelerometer values are given in g (9.81 m/s^2)
and the gyroscope values in deg/s
.
Manual Wired and Wireless
Another way of connecting IMU sensors is to manually create ImuSensor
objects. This can be done by specifying the mode and the address of the sensor.
from CreaTeBME.ImuSensor import ImuSensor, MODE_WIRED, MODE_WIRELESS
sensor_wired = ImuSensor(MODE_WIRED, 'COM4')
sensor_wireless = ImuSensor(MODE_WIRELESS, '01:23:45:67:89:AB')
For a wired sensor, the address is the serial port on the computer, on Windows this will be COM
followed by a number.
For a wired sensor, the bluetooth address is used, this will look like 01:23:45:67:89:AB
.
Common errors
Windows installation
On Windows, during the installation a compile error for pybluez will likely come up.
To solve this, install the pybluez 0.22 wheel before installing this package. A PyBluez 0.22 wheel for Python 3.8 can be found here.
Download it to your current directory and install it using pip install PyBluez-0.22-cp38-cp38-win_amd64.whl
.
Running in PyCharm
When using this package and running your program in PyCharm, an error complaining about CMD not being found can show. To solve this, run py xxx.py
in the terminal, where xxx
is the file name of the python file you want to run.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for CreaTeBME-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a89965d1a1062605fe6fdc6b66f6b9a39bffe1e3d67b50dac39e4cb097d4653 |
|
MD5 | 06b5519a9c755140437f46c9c5af2be9 |
|
BLAKE2b-256 | 9ac9e9879c7ebf1a052542f0a60f802e38e2db0f8ee4860f50c190b021a3deab |