https://github.com/hirschenberger/modbus-rs
Modbus implementation in pure Rust
https://github.com/hirschenberger/modbus-rs
modbus rust
Last synced: about 1 year ago
JSON representation
Modbus implementation in pure Rust
- Host: GitHub
- URL: https://github.com/hirschenberger/modbus-rs
- Owner: hirschenberger
- License: mit
- Created: 2015-11-03T01:00:32.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2025-01-24T12:59:25.000Z (over 1 year ago)
- Last Synced: 2025-04-19T03:06:37.653Z (about 1 year ago)
- Topics: modbus, rust
- Language: Rust
- Size: 355 KB
- Stars: 99
- Watchers: 8
- Forks: 23
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rust Modbus
[](https://github.com/hirschenberger/modbus-rs/actions/workflows/rust.yml)
[](https://crates.io/crates/modbus)
[](https://docs.rs/modbus/latest/modbus)
[](https://crates.io/crates/modbus)
[](http://doge.mit-license.org)
Modbus implementation in pure Rust.
## Usage
Add `modbus` to your `Cargo.toml` dependencies:
```toml
[dependencies]
modbus = "1.1"
```
Import the `modbus` crate and use it's functions:
```rust
use modbus::{Client, Coil};
use modbus::tcp;
let mut client = tcp::Transport::new("192.168.0.10");
client.write_single_coil(1, Coil::On).unwrap();
client.write_single_coil(3, Coil::On).unwrap();
let res = client.read_coils(0, 5).unwrap();
// res == vec![Coil::Off, Coil::On, Coil::Off, Coil::On, Coil::Off];
```
See the [documentation](https://docs.rs/modbus/latest/modbus) for usage examples and further reference and
the [examples](https://github.com/hirschenberger/modbus-rs/tree/master/examples) directory for a commandline client application.
## License
Copyright © 2015-2025 Falco Hirschenberger
Distributed under the [MIT License](LICENSE).