Have you used/explored the Latch block from the Utilities library in Simulink?

Below is a screenshot of a Simulink diagram that shows two sets of blocks for controlling servos using buttons. Both set of blocks do the same except that the top one has a Latch block included. The graphs show how the Latch blocks affects the servo angle output for the same pattern of button presses (1 is press and 0 is not pressed).

Can you explain what is the Latch block doing in the top set and how is it beneficial when programming a robot arm? LEAVE RESPONSES/COMMENTS BELOW!

Interested in this Simulink file? Download from here: (Click on the Download icon on the top of this page)


Quote 0 0
The latch block will program it so that when you press the button lifting "the arm", it will stay up until the button is pressed again. This is in contrast with the non latch block version, where you would need to keep the button pressed constantly in order to keep the arm up.

Quote 1 0
Agree with widerbestrobot...

The latch function holds the signal from the digital button at 1 even after it is released.  This will in turn hold the servo in the desired position.  When the button is pressed and released a second time, the latch function drops the signal to 0 and the servo returns to the neutral position.

Without the latch function, the servo only holds the desired position while the button is depressed.
Quote 1 0