| Crates.io | unishock |
| lib.rs | unishock |
| version | 0.1.0 |
| created_at | 2025-12-14 19:10:00.592869+00 |
| updated_at | 2025-12-14 19:10:00.592869+00 |
| description | Rust crate to interface with various shockers (PiShock/OpenShock). |
| homepage | |
| repository | https://github.com/polina4096/unishock |
| max_upload_size | |
| id | 1984948 |
| size | 44,971 |
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.
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()?);