Here are two LabVIEW examples.
They are just two different styles, pick what you are most comfortable with.
When the limit switch is wired Normally Open (NO) it reads in the code as false when pressed.
Wired Normally Closed it reads in the code as true when pressed.
Wire to Ground (GND) and pick only one of the other two NC or NO.
If you look at the side of the limit switch, most of them have a diagram labeled GND, NO, and NC to show where the wires go.
If there is no label, then use a multimeter to figure out which is the ground and which is NC or NO.
