basic/basic.rs
1use std::thread;
2use std::time::Duration;
3use trackpad_haptic::{Feedback, FeedbackManager};
4
5fn main() {
6 let haptic_manager = FeedbackManager::default();
7 loop {
8 // Shortest possible
9 haptic_manager.trigger();
10 thread::sleep(Duration::from_secs(1));
11
12 // 1 second of continuous feedback
13 let length_millis = 1000;
14 let delay_millis = 1000;
15 haptic_manager.trigger_with_feedback(
16 Feedback::new(length_millis, delay_millis)
17 );
18 }
19}