Hi,
If your limit swtiches are connected between the input pins and gnd, do you have pullup resistors for each of the switches?
This is to pull the respective input high when the switch is open.
OR.
You can turn the internal pullups by declaring your pinMode this way.
pinMode(lmswitch1 , INPUT_PULLUP);
pinMode(lmswitch2 , INPUT_PULLUP);
Can you post a copy of your circuit please?
Thanks.. Tom...
![]()