Simple, generalised edge detection for variables as well as input signals
Works with Arduino and Wiring.