Crates.io | islabtech-upw-sensor-v1 |
lib.rs | islabtech-upw-sensor-v1 |
version | 0.1.4 |
source | src |
created_at | 2024-05-22 22:02:45.130572 |
updated_at | 2024-05-28 17:40:40.613596 |
description | Rust client library for remote control of the ISLabTech UPW Sensor v1 |
homepage | |
repository | https://gitlab.com/islabtech/upw-sensor/remote-rs |
max_upload_size | |
id | 1248845 |
size | 77,790 |
Rust client library to communicate with the ISLabTech UPW Sensor
Examples can be found in the examples directory. Try out the Getting Started example.
use islabtech_upw_sensor_v1::{connect_via_network_on_port, Device, Error};
use tokio; // use `await` in main function
use std::{thread::sleep, time::Duration};
#[tokio::main]
async fn main() -> Result<(), Error> {
let sensor = connect_via_network_on_port(
"192.168.1.123".parse().unwrap(),
80.into(), // port (defaults to 80)
Default::default(), // TLS
);
loop {
let measurement = sensor.latest_measurement().await?;
println!("measurement: {measurement:?}");
sleep(Duration::from_secs(1))
}
}
This project is licensed under the Apache 2 license.