01They Don't Actually "Read Thoughts"

You want to type a letter on the screen, so you press a key; You want to open an icon, so you move the mouse and click.

It might seem like the keyboard and mouse "know what you want to do," but that's not actually the case. They only detect your physical actions and convert these actions into data that the computer can receive.

Human Action

Key presses, movements, clicks, scrolling

Device Detection

Converts actions into electronic signals and data

Computer Processing

Operating system and programs interpret this input

02What Happens When You Press a Key?

Underneath a keyboard, each key doesn't directly have a separate wire connecting to the computer. Common keyboards internally use a set of circuits arranged in a grid-like structure to detect key presses.

1

You Press a Key

For example, pressing the A key

2

Keyboard Detects Position

Controller determines which key was pressed

3

Converts to Key Information

Device encodes "which key, pressed or released" into data

03How Does a Mouse Know It Has Moved?

Modern optical mice have a light source and sensor on the bottom. They continuously observe tiny changes on the desktop surface and calculate how much the mouse has moved relative to its position.

Optical Mouse

Illuminates Surface
Rapid Sampling
Calculates Movement

Mice usually don't tell the computer: "I'm now at pixel 500,300 on the screen."

More commonly, they tell the computer: "I moved a bit to the right and a bit upward."

04How Is This Information Sent to the Computer?

After keyboards and mice detect actions, they still need to send the data to the computer. Common methods include USB wired connections and wireless connections.

USB

Data is transmitted to the computer through cables

Wireless

Transmitted via Bluetooth or wireless receiver

Devices Send "Input Reports"

Common USB keyboards and mice belong to HID (Human Interface Device). They report key presses, buttons, and movement information to the computer in specified formats.

The underlying details of different devices and connection methods are not exactly the same. Here we're introducing the basic working model of common personal computer keyboards and mice.

05How Do Computers Convert Input into Text and Actions?

After devices send data to the computer, it's not yet accurate to say "the program has received a letter." The operating system and drivers first process device input, then deliver appropriate events to running programs.

Keyboard / Mouse

Reports key presses, movements, and buttons

Operating System / Drivers

Recognizes devices and processes input

Applications

Execute their own functions based on input

Keyboard Input

The same key press might input characters in a text editor; represent "move forward" in a game; or represent another command in a shortcut.

Mouse Input

Movement data can change cursor position, while clicks are interpreted by the current program as selection, opening, dragging, and other operations.

06Understanding the Complete Process with an "Input A" Example

Suppose you're in English input mode and press the A key in a text editor. We can simplify the entire process into the following path:

1

Finger Presses Key

You press the A key

2

Keyboard Detection

Knows a certain key was pressed

3

Send to Computer

Send data via USB or wireless

4

Software Processing

System interprets input based on layout, key state, etc.

5 Display

Display Character

Text editor finally displays A or a

What You've Learned

  • Keyboards and mice can't read human thoughts; they can only detect actions like key presses, movements, and clicks.
  • Keyboards detect which keys are pressed or released and encode this information into data.
  • Optical mice observe surface changes and calculate relative movement.
  • Keyboards and mice can send data to computers via USB, Bluetooth, or wireless receivers.
  • Common keyboards and mice belong to HID (Human Interface Device).
  • Operating systems and programs continue to interpret input, so the same key can have different effects in different programs.
  • Input devices are responsible for "reporting actions," while software is responsible for "determining what these actions mean."

Next Question: After keyboards and mice send information to the computer, how do screens display text, images, and game graphics? Next article: How Do Screens Display Images?