A simple sketch illustrating the usage of the binary hall-effect switch. The sketch uses interrupts in order to work async and as fast as possible. 

When you see the fritzing sketch, I used a transistor as the symbol of the 3144 hall-effect sensor, as there is no such symbol.