Utilities for RX/TX with Arduino devices
Project description
InoIO
A small library for RX/TX with Arduino devices.
Table of Contents
Installation
To install the library, simply run:
pip install inoio
Example
The following snippet demonstrates how to use the library:
import sys
from inoio import InoIO, errors
def main() -> None:
conn = InoIO(port="/dev/ttyS2", baudrate=9600)
try:
conn.connect()
except errors.InoIOConnectionError:
sys.exit("Failed to connect")
conn.write("A foo that bars")
print(conn.read())
conn.disconnect()
if __name__ == "__main__":
main()
Running this small program would return:
Received message: A foo that bars
Assuming the following code is uploaded to the device and the device is running:
void setup()
{
unsigned int baudrate = 9600;
::Serial.begin(baudrate);
unsigned int timeout_msec = 10;
::Serial.setTimeout(timeout_msec);
}
void loop()
{
while (::Serial.available() > 0)
{
::String message = ::Serial.readString();
message.trim();
::Serial.println("Received message: " + message);
::Serial.flush();
}
}
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
inoio-0.1.0.tar.gz
(5.0 kB
view details)
Built Distribution
inoio-0.1.0-py3-none-any.whl
(4.7 kB
view details)
File details
Details for the file inoio-0.1.0.tar.gz
.
File metadata
- Download URL: inoio-0.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b2e811d01db124b98e7d513060a439115161fc5b7ee802d217c15fcaff363b7 |
|
MD5 | 790147b971b4be83b99fdb3ece055c50 |
|
BLAKE2b-256 | bdd3afb11d636afd18eb9d46ed4b4452ee9c91495bd5e0a6b98da290d8ccca22 |
Provenance
File details
Details for the file inoio-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: inoio-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17c5ca5f4c65dc5f86b20c6826e7340f1b425c2603e5709565c481c871884929 |
|
MD5 | 0c9cf934e738aff27cac0d80e89ac52e |
|
BLAKE2b-256 | 07ec86fd6de20dff19f8a2efb5ce22cdb3cbd55e04ddf24b386e63dc3d552c04 |