Skip to main content

A simple package for controlling Bluetooth Battery Circuit Cubes.

Reason this release was yanked:

1.1.2 fixes issues with macOS

Project description

CircuitCubes (Version 1.1.0)

CircuitCubes is a package for easily controlling Tenka's Bluetooth Circuit Cube 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()

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) and time.
  • If time is zero, then the motor will run indefinitely.
  • The keyword argument smooth if 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 letters and velocities.

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 terminal
  • address (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.

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_constants' 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 address are in a 128-bit UUID becuase of the operating system's Core Bluetooth framework.

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 GitHub Repository

simonwong.site

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

circuitcubes-1.1.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

circuitcubes-1.1.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file circuitcubes-1.1.0.tar.gz.

File metadata

  • Download URL: circuitcubes-1.1.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for circuitcubes-1.1.0.tar.gz
Algorithm Hash digest
SHA256 73e19750257981139fc4a48c6ea97c54a465dfe8f9eca12d9479b21c9824cae3
MD5 9e9c4d6a3e54d8fba98d8f646208b338
BLAKE2b-256 e6634aee11958280d12546f322df3ec9713a48b5c02bd4887d2ad9b6cecbeca6

See more details on using hashes here.

File details

Details for the file circuitcubes-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: circuitcubes-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for circuitcubes-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8534e9ec0bb46834b4e51ba9b32e830db2efdca431e7eb9b3da0671e38d25666
MD5 d516c4ed0777e9a7ca6890b3b90e9054
BLAKE2b-256 aed35781da4b81bae5ec43355a1366b3ff62ebf4cd41ecc11783d948b864c110

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