Crate plctag_async

Source
Expand description

§plctag-async

async wrapper for libplctag.

crates.io docs build license

§How to use

Add plctag-async to your Cargo.toml

[dependencies]
plctag-async= "0.4"

§Examples

use plctag_async::{Error, AsyncTag};
use tokio::runtime;

let rt = runtime::Runtime::new().unwrap();
rt.block_on(async {
   let path="protocol=ab-eip&plc=controllogix&path=1,0&gateway=192.168.1.120&name=MyTag1&elem_count=1&elem_size=16";// YOUR TAG DEFINITION

   let mut tag = AsyncTag::create(path).await.unwrap();
   let offset = 0;
   let value:u16 = tag.read_value(offset).await.unwrap();
   println!("tag value: {}", value);

   let value = value + 10;
   tag.write_value(offset, value).await.unwrap();
});

§License

MIT

Structs§

AsyncTag
tag entry, represents a tag in PLC controller

Enums§

Error
errors for [plctag-async]

Type Aliases§

Result
result for [plctag-async]