5 releases
0.1.4 | Jul 5, 2020 |
---|---|
0.1.3 | Jun 21, 2020 |
0.1.2 | Jun 19, 2020 |
0.1.1 | Jun 15, 2020 |
0.1.0 | Jun 15, 2020 |
#724 in Hardware support
52 downloads per month
98KB
2.5K
SLoC
toio-rs
toio driver in Rust
- Supports all the messages defined in the technical specification (ver. 2.1.0).
- Supports async/await.
- Provides the similar capability as JavaScript version.
- Provides the high-level API, which is easy to use.
- Provides the low-level API, which allows fine-grained control and configuration.
- Plans to be cross-platform. The targets are:
- macOS
- Windows 10 (TODO)
- Linux (TODO)
use std::time::Duration;
use toio::Cube;
use tokio::time::delay_for;
#[tokio::main]
async fn main() {
// Search for the nearest cube
let mut cube = Cube::search().nearest().await.unwrap();
// Connect
cube.connect().await.unwrap();
// Move forward
cube.go(20, 20, None).await.unwrap();
delay_for(Duration::from_secs(3)).await;
// Move backward
cube.go(-15, -15, None).await.unwrap();
delay_for(Duration::from_secs(3)).await;
// Spin counterclockwise
cube.go(5, 50, None).await.unwrap();
delay_for(Duration::from_secs(3)).await;
// Spin clockwise
cube.go(50, 5, None).await.unwrap();
delay_for(Duration::from_secs(3)).await;
// Stop
cube.stop().await.unwrap();
}
Dependencies
~8–18MB
~210K SLoC