Evaluation unit 14, sensor elements 8, 10, key 28 for learning the switching signals, and display 36 are preferably arranged in a common housing 30. In this manner, the magnetic sensors can be very compact and include all components that are necessary for the proper functioning of magnetic sensor 1. Only the signal leads, the digital interface or the bus system need to be connected to a overall control arrangement.