Crates.io | firmata-rs |
lib.rs | firmata-rs |
version | 0.4.3 |
source | src |
created_at | 2023-06-23 22:06:20.642012 |
updated_at | 2024-03-24 12:43:28.255052 |
description | A Firmata protocol client library. |
homepage | https://gitlab.com/Tiemen/firmata-rs |
repository | https://gitlab.com/Tiemen/firmata-rs |
max_upload_size | |
id | 898636 |
size | 60,119 |
Control your Firmata devices from Rust!
The library comes with a Board struct, which you can initialize with any object that implements
std:io::{Read, Write}
and Debug
for formatting purposes. This avoids being locked in to a
specific interface library. I highly recommend serialport
for your USB connections (used in
examples), but feel free to use serial
or any other.
The different methods of the Firmata
trait that return results also have backoff-able
counterparts in the RetryFirmata
trait that utilizes a ExponentialBackoff
strategy powered by
the backoff
crate. This may be useful as your Rust program may run "too fast" for your Firmata
device to keep up.
The crate has been set up to utilize tracing
, which helps in finding where your messages went!
If you set the environment variable CARGO_LOG=DEBUG
you can capture the most noise.
There are quite a couple of examples to try with your Firmata device! You can run each of them like this:
cargo run --example blink
Where blink
is the example's filename.
If you want the "full" output you can use:
RUST_LOG=DEBUG cargo run --example blink
Chances are you have an Arduino or other Firmata device lying around since you're here :). You can go to your favorite Arduino IDE of choice and load the regular "StandardFirmata" onto your device and start tinkering!
You might need to set the USB port to the one that is in use on your machine. Find the right
port_name
in the list after running:
cargo run --example available
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
This library is largely based on the earlier work by Adrian Zankich over at https://github.com/zankich/rust-firmata to whom should go out many thanks!