pub fn connect<'a, E: Copy + Debug>(
term1: &'a RefCell<Terminal<'a, E>>,
term2: &'a RefCell<Terminal<'a, E>>,
)Expand description
Connect two terminals. Connected terminals should represent a physical connection between
mechanical devices. This function will automatically disconnect the specified terminals if they
are connected. You can manually disconnect terminals by calling the
disconnect method on either of them.
Examples found in repository?
examples/devices.rs (line 78)
67fn main() {
68 println!("Commanding Motor to {:?}", COMMAND);
69 println!(
70 "K values are {:?}",
71 K_VALUES.get_k_values(PositionDerivative::from(COMMAND))
72 );
73 let motor = Motor::new();
74 let mut motor_wrapper =
75 devices::wrappers::PIDWrapper::new(motor, Time(0), STATE, COMMAND, K_VALUES);
76 let encoder = Encoder::default();
77 let mut encoder_wrapper = devices::wrappers::GetterStateDeviceWrapper::new(encoder);
78 connect(motor_wrapper.get_terminal(), encoder_wrapper.get_terminal());
79 for _ in 0..5 {
80 motor_wrapper.update().unwrap();
81 encoder_wrapper.update().unwrap();
82 }
83}