An optical mouse is a computer mouse which uses a light source, typically a light-emitting diode (LED), and a light detector, such as an array of photodiodes, to detect movement relative to a surface. It is an alternative to the mechanical mouse, which uses moving parts to sense motion.
You might have noticed that each encoder disk has two infrared LEDs and two infrared sensors, one on each side of the disk (so there are four LED/sensor pairs inside a mouse). This arrangement allows the processor to detect the disk’s direction of rotation. There is a piece of plastic with a small, precisely located hole that sits between the encoder disk and each infrared sensor.
Some optical mice have two LEDs. The first one shines light down onto the desk. The light from that is picked up by the photocell. The second LED lights up a red plastic strip along the back of the mouse so you can see it’s working. Most optical mice also have a wheel at the front so you can scroll pages on-screen much faster. You can click the wheel too, so it functions like the third (center) button on a conventional ball mouse.