unishock

Crates.iounishock
lib.rsunishock
version0.1.0
created_at2025-12-14 19:10:00.592869+00
updated_at2025-12-14 19:10:00.592869+00
descriptionRust crate to interface with various shockers (PiShock/OpenShock).
homepage
repositoryhttps://github.com/polina4096/unishock
max_upload_size
id1984948
size44,971
Полина (polina4096)

documentation

README

unishock

Rust crate to interface with various shocker devices including PiShock and OpenShock.

Currently this crate only supports serial communication for PiShock hubs and nothing else. Other ways to interact with the devices and OpenShock support is planned.

All functionality supported by the PiShock serial port protocol is implemented.

Examples

Beep a connected PiShock shocker:

let ports = PiShockHub::available_ports()?;
let port = ports.first().expect("no PiShock hubs found");
let mut hub = PiShockHub::connect(port, Duration::MAX)?;

let shocker_id = 1337; // From the hub info/website.
let duration = 100;    // In milliseconds.
hub.beep(shocker_id, duration)?;

Retrieve current PiShock hub state:

let ports = PiShockHub::available_ports()?;
let port = ports.first().expect("no PiShock hubs found");
let mut hub = PiShockHub::connect(port, Duration::MAX)?;

println!("{:#?}", hub.info()?);

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in unishock by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Commit count: 0

cargo fmt