Can i use "Micro Limit Switch" for this code

int switchUpPin = 13;
int switchDownPin = 12;
int counter = 0;
int buttonUpState = 0;
int lastButtonUpState = 0;
int buttonDownState = 0;
int lastButtonDownState = 0;

This code is for a Push Button, My question is can i use this code to "Micro Limit Switch"

Thank you for helping :slight_smile:

It's hard to say without more information. A micro limit switch works the same as a push button so likely the answer is yes. The snippet of code you bothered to post indicates there are two pins used with switches. Are those two separate switches or a single switch that uses two pins?