Now think of a digital compass. They work by measuring the pull of a magnetic field ... available in your programming language of choice. Arduino (used here) makes use of the avr-libc math ...
However it’s easy to forget that the devices that provide a magnet-or-not digital ... measure a static magnetic field. It’s something [mircemk] demonstrates, with an Arduino-powered magnetic ...