Skip to content

dclause/hermes-five

Repository files navigation

Hermes-Five

License Build Status Test Status Docs Status Code Coverage crates.io Documentation

The Rust Robotics & IoT Framework

Drive and orchestrate Arduinos, ESPs, nodeMCU, RaspberryPis and all kind of Firmata-compatible hardware in pure async Rust. Control LEDs, sensors, motors from your laptop with the safety and speed of Rust.

Program robots and embedded devices with confidence. Hermes-Five gives you high-level APIs to remotely control boards ( Arduino, ESP, nodeMCU, RaspberryPI, ..), extenders (PCA9685, PCF8575, ..) LEDs, sensors, servos and more, all from safe and asynchronous Rust code. Think Johnny-Five, but safer, faster, and fully async.

Schema sample of blinking led using Arduino UNO

Documentation

Hermes-Five offers three main documentation sources:

Key Features

  • 🧠 High-level abstractions: Control LEDs, sensors, buttons, servos and all kind of devices. Write expressive, async Rust code to control them.
  • 🛜 Protocol-agnostic: Serial, WiFi and Bluetooth supported (via Firmata).
  • 🧩 Modular design: Plug-and-play support for boards and devices. Arduino, ESP32, nodeMCU, Raspberry Pi, etc.
  • 🕹️ Animation engine: Interpolate servo movements, LED fades and more with ease.
  • 🧪 Test-friendly: Includes mocks to run and test logic without hardware.

🖱️ Prefer a GUI over code? Try Hermes-Studio - a visual programming interface powered by Hermes-Five.

Getting started

cargo new my_awesome_project
cd my_awesome_project
  • Add this crate to your dependencies in the Cargo.toml file.
[dependencies]
hermes-five = "0.1.0"

Tip

Feature flags:

  • libudev -- (enabled by default) Activates serialport crate libudev feature under-the-hood (required on Linux only for port listing).
  • serde -- Enables serialize/deserialize capabilities for most entities.
  • mock -- Provides mocked entities of all kinds (useful for tests mostly).

Hello Hermes!

The following example shows the simplest possible program: from your computer, command a serially connected Arduino to blink its built-in LED on pin 13.

use hermes_five::hardware::{Board, BoardEvent};
use hermes_five::devices::Led;

#[hermes_five::runtime]
async fn main() {

    // Register a new board 
    // (of type arduino + auto-detected serial port by default)
    let board = Board::start().unwrap();

    // When board communication is ready:
    board.on(BoardEvent::OnReady, |board: Board| async move {

        // Register a LED on pin 13 (arduino embedded led).
        // Pin: 13; OFF by default
        let mut led = Led::new(&board, 13, false)?;

        // Blinks the LED every 500ms: indefinitely.
        led.blink(500);

        Ok(())
    });
}

Examples

All available examples can be found in the examples folder.

To start an example, run the following command:

cargo run --example folder_examplename

To run an example in a file called examples/folder/examplename.rs, use the concatenation name as folder_examplename.

If you want the "full" log output you can use:

RUST_LOG=DEBUG cargo run --example folder_examplename

Roadmap

For details, see the full roadmap: currently working toward release 0.2

Contribution

All contributions are more than welcome through PR and the issue queue.

  • Fork the repository
  • Create a new branch: git checkout -b feature-branch
  • Commit your changes: git commit -am 'Add new feature'
  • Push to the branch: git push origin feature-branch
  • Create a new Pull Request

The author does not claim to know everything about Rust programming or IoT, and all ideas are welcome as long as they respect the project's original philosophy.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For support, please open an issue or reach out to the author.

About

The Rust Robotics & IoT Platform.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages