It is also possible to learn and store several switching signals 18. For this it is only necessary to move piston 6 into a new position D the location of which is to be learned by pressing key 28 to initiate the learning mode. In this manner, a large number of switching signals can be sequentially taught and learned. For this it is not necessary to move magnetic sensor 1 relative to pneumatic cylinder 34. The learned piston positions can be arranged closely adjacent to each other and, for example, at a lesser distance than spacing 12 between sensor elements 8 and 10.