6 releases (3 breaking)
0.4.0 | Mar 13, 2020 |
---|---|
0.3.0 | May 24, 2019 |
0.2.0 | Sep 11, 2018 |
0.1.2 | Jun 18, 2018 |
0.1.1 | Apr 24, 2018 |
#977 in Hardware support
13KB
254 lines
UR20 Modbus
ur20-modbus
is a Rust library for communicating with the
Modbus TCP fieldbus coupler Weidmüller UR20-FBC-MOD-TCP.
License
Copyright (c) 2018-2020, slowtec GmbH
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
lib.rs
:
ur20-modbus
is a Rust library for communicating
with the Modbus TCP fieldbus coupler Weidmüller UR20-FBC-MOD-TCP.
Example:
use std::error::Error;
use ur20_modbus::Coupler;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let addr = "192.168.0.222:502".parse()?;
let mut coupler = Coupler::connect(addr).await?;
let id = coupler.id().await?;
println!("Connected to {}", id);
coupler.set_output(
&ur20::Address {
module: 3,
channel: 2,
},
ur20::ChannelValue::Bit(true),
)?;
coupler.tick().await?;
Ok(())
}
Dependencies
~7MB
~132K SLoC