If "Joyjoy" is interested in obtaining the frequency of a spinning magnet, or
if he wants to detect the presence or absence of a moving magnet, he could use
a reed switch or a hall effect sensor. Both of them would detect the presence
or absence of a magnet.