Skip to main content

A Python library for the ftSwarm Python API

Project description

📚 Client library for the ftSwarm Serial API

This library provides a simple interface to the ftSwarm Serial API in a python 3 way.

⚙️ Installation

To install the latest version of the library, run the following command:

pip install ftswarm-py

🚲 Usage

The library provides a simple interface to the ftSwarm Serial API. The following example shows how to connect to the ftSwarm and read a button named "button1" from the ftSwarm.

import asyncio
from swarm import FtSwarm


async def read_button():
    swarm = FtSwarm("/dev/ttyUSB0")  # Change this to your serial port
    button = await swarm.get_button("button1")

    print(button.get_state())

asyncio.run(read_button())

Let's just go over the code above. The following steps are performed:

  • Creating an async context
  • Creating a FtSwarm object with the serial port as parameter
  • Getting the button named "button1" from the ftSwarm
  • Printing the state of the button

Quite simple, right?

Another simple example can be found at the quickstart section of the documentation.

📝 Documentation

The library is documented using docstrings. You can also find the documentation on my website.

🙆 Contributing

If you want to contribute to the project, feel free to open a pull request. I will review it as soon as possible. Before adding large features, please open an issue first to discuss the feature, so that you don't waste your time.

⚖️ License

This project is licensed under the MIT license. You can find the license in the LICENSE file.

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

ftswarm_py-1.2.2.tar.gz (7.2 kB view hashes)

Uploaded Source

Built Distribution

ftswarm_py-1.2.2-py3-none-any.whl (8.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page