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.3.0.tar.gz
(5.3 kB
view details)
Built Distribution
inoio-0.3.0-py3-none-any.whl
(4.8 kB
view details)
File details
Details for the file inoio-0.3.0.tar.gz
.
File metadata
- Download URL: inoio-0.3.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6a04fdda411548150f72b204934129f8c0c0b06828850fe62044350e9efd5da |
|
MD5 | e413ff9927eb421b22f96f3d5f473f50 |
|
BLAKE2b-256 | 1ed0c4e49aaa2b382e8e06f06830abc9d22dc487da5a63558b39497d2050222d |
File details
Details for the file inoio-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: inoio-0.3.0-py3-none-any.whl
- Upload date:
- Size: 4.8 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 | c51bcdffac3476ed3b93cccbda1b6997a8b8dbd1ec17630fe5169442d780acb8 |
|
MD5 | d9ff364ba389275033d02857fdb91fd2 |
|
BLAKE2b-256 | e7d964efbcef7c915e6b9df71f0bcf1d81c951a6494436eec85365d67d50895e |