Blocking -VDC

123Splat:
Instead of asking the sensors (polling), what about having the sensors alert you (interrupts)?

Really, really bad idea!

Almost always is.

Based on the sadly mistaken premise that the purpose of an interrupt is to affect in some way the function of the main program. In fact, the whole design of interrupts is that they do not affect the function of the main program.

An interrupt will occur at any point in the main program (loop). But of course, there are only certain points in that main program where you need to know about particular events, so you code to assess those events at those points. It would get very confusing otherwise.

OK, let's look at the simplest way to implement this particular project. The OP has opted for a magnet glued to the shaft and a "magnetic proximity switch" which may be a reed switch or should be a Hall Effect transducer.

Fine! To determine direction of rotation, we just need another magnetic sensor adjacent so that there is overlap of them switching on. How easy is that? This presumes that we are not concerned about determining speed or direction in less than one or two revolutions. The function is a quadrature encoder but does not need to be symmetrical. On any transition, the immediate direction can be determined by comparing the present and previous states of the two sensors. Hall effect sensors will generally be free of contact bounce to avoid ambiguity.