A simple package for controlling Bluetooth Battery Circuit Cubes.
Project description
CircuitCubes (Version 1.1.3)
CircuitCubes is a package for easily controlling Bluetooth Circuit Cubes with Python.
This package makes it as simple as possible to start interacting with your Circuit Cube, requiring only two lines of code to initialize the Circuit Cube.
from CircuitCubes import Cube
cube = Cube()
This package is verbose by default, but the keyword argument verbose=False can be passed to the Cube class.
Motor commands
To turn on a single motor, use Cube.run_motor method.
- It takes the arguments
letter('A', 'B', or 'C'),velocity(-100 to 100) andtime. - The keyword argument
smoothif set to true will keep the motor running after the time is done.
To run multiple motors, use the Cube.run_motors method.
- This method is very similar to the previous, except its first two arguments take the lists
lettersandvelocities.
To stop all motors, use the Cube.halt method.
To disconnect the Circuit Cube, use the Cube.disconnect method.
Other functionality
The Cube.information method prints details about the connected Circuit Cube to the terminal.
- Device name (should always be Tenka).
- BLE appearance code.
- Serial number.
- Firmware version.
- Hardware version.
- Software version.
- Battery voltage.
The CircuitCubes.Cube() class has three keyword arguments. These are not necessary to input when first initializing the Circuit Cube.
verbose(boolean) when true will output details to the terminaladdress(string in format 'aa:bb:cc:dd:ee:ff) allows providing the Bluetooth hardware address of your Circuit Cube.jupyter(boolean) allows specifying whether the package is in an interactive environment.
The Cube.help method prints a link to the project GitHub repository in the terminal.
The Cube.battery method returns the Circuit Cube battery voltage.
Technicalities
This package is made up of two classes Cube and Constants.
- Most users should not need to interact with the constants class.
- The constants class contains all of the Bluetooth Circuit Cube's BLE GATT characteristics, descriptors, and handles.
- These constants can be printed to the terminal using the `cube.get_constant' method, which takes an integer from 0 to 28 as input.
- The input integers correspond to indices of a list (for example 2 corresponds to the BLE transmission GATT characteristic).
This package contains lots of asynchronous code, but conveniently makes it appear synchronous to the user. Therefore, using the CircuitCubes with asynchronous python code is not recommended.
On computers running macOS, Bluetooth addresses are in a 128-bit UUID because of the operating system's Core Bluetooth framework. Also because of this, running in a non-interactive Python environment may not work properly. However, running in a Jupyter notebook will work properly.
Planned development
- More advanced motor control methods.
- Support for using more than one CircuitCube at the same time.
- Functionality based on battery level.
Links
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file circuitcubes-1.1.3.tar.gz.
File metadata
- Download URL: circuitcubes-1.1.3.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25a7844399b7cd2fc614a83fd253d82dceb6f4415b3da85488be5ec12426b480
|
|
| MD5 |
d3467af4e3b3b4d60b996b36eaa8f210
|
|
| BLAKE2b-256 |
4effddb0e5a92a69977e79d42fc4f92dd0b75da7205cabf81690434d97b90f35
|
File details
Details for the file circuitcubes-1.1.3-py3-none-any.whl.
File metadata
- Download URL: circuitcubes-1.1.3-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acc5370532f37d3f1f1a70f73c53dd7e8a6dd8558be24eca4dd05574e818b417
|
|
| MD5 |
bca06a72f19856ed44ee620d896165fa
|
|
| BLAKE2b-256 |
1d5899589ad0be3c69c8a81c029dcdee2c12aa34b38427a96be40a709b979c87
|