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
Built Distribution
Hashes for ftswarm_py-1.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a044e81fca878f80dad888ef0b6cfbd682c20cb556c2f4f04628b4dfb082ffc |
|
MD5 | dc9cc2303db9499457bf81764f8d5491 |
|
BLAKE2b-256 | 5af298655693b895e1ae8027dee9da6f7ffb177ec6c6ed44629cef8d7f8806f3 |