Skip to main content

ZorbPy

Python library for integrating with the Somatic Zorb Engine

license Twitter

Installation

First install the Adafruit BluefruitLE library.

Please note that this library only currently supports macOS and Linux, as Windows is not currently supported by the underlying BLE package used for this library.

After installing the BluefruitLE library, installation of ZorbPy using pip is simple:

pip install zorb

Library Usage

For a quick example on how to use the ZorbPy library, please reference example.py.

To use the ZorbPy library, you must wrap the functionality of your program in a function that is passed to the zorb.run() function call.

Any usage of the functions provided by this library outside of the process started by zorb.run() will produce error behavior.

The ZorbPy library provides three main functionalities:

  • connecting to advertising Zorb devices

  • triggering presets on the Zorb device

  • directly controlling actuator intensity on the Zorb device

To connect to an advertising Zorb device:

zorb.connect()

To trigger one of the available presets:

zorb.triggerPattern(zorb.POINT_LEFT)

Note that preset haptic emojis are exist for the following emojis:

🎊, 👈, 👉, 🤛, 🤜, ⏮️, ⏭️, 🙌, 👋, 😯, 😳, 😬, 😊, 😄, 🤣

To directly set the actuator values:

duration = 100
top_left = 0
top_right = 0
bottom_left = 25
bottom_right = 25

zorb.writeActuators(duration, top_left, top_right, bottom_left, bottom_right)

Below is a more comprehensive example of a simple program that connects to a Zorb device, plays a confetti pattern upon successful connection, and then updates actuator values based on some hypothetical sensor output.

import zorb

def mainloop():
    # perform initial connection to Zorb device
    zorb.connect()

    # trigger confetti effect upon successful connection
    zorb.triggerPattern(zorb.CONFETTI)

    # enter infinte loop for updating Zorb device
    while True:
        top_left = hypothetical_sensor_1.val()
        top_right = hypothetical_sensor_2.val()
        bottom_left = hypothetical_sensor_3.val()
        bottom_right = hypothetical_sensor_4.val()
        zorb.writeActuators(10, top_left, top_right, bottom_left, bottom_right)
        time.sleep(0.01)


def main():
    zorb.run(mainloop)


if __name__ == '__main__':
    main()

Style Guide

Contributions to this project should conform to this Python Style Guide.

License

ZorbPy is released under the MIT license.

Metadata

Release files for zorb 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zorb 0.1.5
File Size Uploaded
zorb-0.1.5.tar.gz 5.4 kB Details

Release files / zorb-0.1.5.tar.gz

Download URL zorb-0.1.5.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8d84990ffe5d7a693dfafca7be835305fa7def52fb2a41372a3be91dcd0c0d1b
BLAKE2b-256 checksum
How to use checksums
3ead8408ab815932ec9ee3c7607da3a63701ae0a75f41ec3f5f9e86122a63cd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.5 This release

1 release file

0.1.4

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page