Use a reed switch as a magnet-operated contact, adding a pull-up, debounce, and suitable mechanical placement.
A Hall-effect sensor responds to magnetic field, but its output may be a digital switch, a latch, or a linear analog signal. Not every module provides…