A slotted switch can also be used in a design called a “flag switch.” Flag switches are a special type of slotted switch where a flag blocks the light when an object hits it. These switches can easily replace full mechanical switches. The flags can be used for millions of operations with no signal change. An encoder provides a way to track speed, direction and possibly position, rather than just presence and absence of a target. By knowing the size of the spacing between each gap and the starting position, it is possible to know what length of material has passed through the sensor by counting the gaps.