Sure, just look for changes, either low to high, or high to low.i.e. is the state of the switch different to last time you looked/(or did you mean mechanically?)
This would be easy with an arduino,
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16