For a teacher with a class? The classroom edition has the full plan, slides and standards.

Homeschooling PDF

Family edition

Keyboard Builder: A Keyboard Never Sends a Letter

Ages 12-16 ยท about 45 minutes, in one sitting

Your child gives a small keyboard the arrow keys it does not have, and finds out that a keyboard sends numbers, not letters.

What you need

Before you start: try it once yourself

Open mytekdev.com/try/keyboardbuilder?lesson=a-keyboard-never-sends-a-letter&ref=fam-keyboardbuilder-2. A short guide opens over the app. The keyboard is a 60 percent board, and the customer on the right has no arrow keys and wants them under their fingers. Open the Keymap bench: each cap now shows what its key sends on the layer you are looking at.

  1. Layer 1. Click Layer 1. Every key fades, because a key with nothing on layer 1 is see-through: it does what layer 0 says.
  2. Four arrows. Click the I key on the board. The panel reads "On layer 1 it sends whatever layer 0 says." Click Up under Moving. Do the same for J and Left, K and Down, L and Right. The order closes: "With Fn held, four letters are arrows."
  3. Try it. Press Try your keymap. Click Fn on the board: it stays held, and the line under the board says the computer never hears it. Click I: "Layer 1 answered. The board sent code 52." Click Fn again to let go and click I: "The board sent code 0C. Your computer turned that into "i"."
  4. Caps Lock. Take the order Nobody needs Caps Lock there. On layer 0, click the Caps Lock key and then Backspace under Editing. The customer says "Now I have no Caps Lock at all." On layer 1, click the same key and then Caps Lock under Editing. The order closes.
The moment that lands is pressing I twice on the Type bench. The same switch closes both times, and two different codes go to the computer.

The ideas, in plain words

A keyboard does not know the alphabet. When a switch closes, the keyboard's own program, its firmware, looks up that key in a table called the keymap and sends the code it finds. The codes are the same on every USB keyboard: 04 for the A key, 0C for the I key, 52 for the Up arrow. The computer receives the code and looks it up again, in its keyboard layout setting, to choose a character. That is why the same keyboard types different characters when the computer is set to another language.

A layer is a second keymap on the same keys. While Fn is held, the firmware reads layer 1 in place of layer 0. Fn itself sends nothing to the computer: the keyboard handles it alone. Shift, Ctrl and Alt are different again. They are sent, but as eight on-or-off bits beside the key codes, not as keys.

Small keyboards depend on this. The 60 percent board has no arrows, no F keys and no number pad; they live on a second layer. A laptop does the same thing with its Fn key and the top row.

Do it together

  1. Open mytekdev.com/try/keyboardbuilder?lesson=a-keyboard-never-sends-a-letter&ref=fam-keyboardbuilder-2 together. A short guide opens over the app. Open the Keymap bench and click Layer 1.

    You'll know it worked when: Every key fades: nothing is on layer 1 yet.

  2. Click the I key on the board, then click Up under Moving. Do the same for J (Left), K (Down) and L (Right).

    If you get stuck: Check that Layer 1 is still picked. On layer 0 the letters would be lost.

    You'll know it worked when: The order closes.

  3. Press Try your keymap. Click Fn on the board to hold it down, then click I.

    You'll know it worked when: The line under the board says layer 1 answered and the board sent code 52.

  4. Click Fn again to let go, and click I once more.

    You'll know it worked when: Now the board sent code 0C, and the computer turned that into an i.

  5. Ask: the cap still says I. Which part knows it is an arrow?

    You'll know it worked when: The keyboard: its keymap says so. The switch only closes, and the computer only gets a code.

Talk about it

Ask these while you work together. A child who has understood it can answer them without help:

The last question is the real test: a child who says the code stays the same and the character changes has separated the keyboard's job from the computer's.

For younger and older kids

Younger: For a younger child, stop once the arrows work and let them move a few more keys around.

Older: For an older teen, set the level to High school and read the report the keyboard sends while they hold Shift and a letter.

Keep going

Bring it into other subjects

For your records

Ready to copy into an hour log, a portfolio or a transcript.

LessonKeyboard Builder: A Keyboard Never Sends a Letter
SubjectsComputer science, Technology
Time45 minutes
What we didEdited a keyboard's keymap in a simulation, added a second layer with arrow keys, and explained that a keyboard sends key codes that the computer turns into characters.
Skills practicedKey codes and keymaps; Layers; Hardware and software working together

Keyboard Builder: A Keyboard Never Sends a Letter

Activity sheet (optional)

Name: ______________________________ Date: ______________

Open the app: scan the QR code, or go to mytekdev.com/try/keyboardbuilder?lesson=a-keyboard-never-sends-a-letter

Essential question: When you press a key, what does the keyboard really send, and who decides what it means?

Warm-up: You press the A key and an "a" shows up. What do you think the keyboard sent down the cable? ________________________

  1. Vocabulary. Key code, keymap, layer, firmware, macro: write each in your own words.
  2. The table. On the Type bench, press each key and copy from the line under the board: the code sent, and what the computer turned it into. The keys: I, then I with Fn held, then the Caps Lock key, then left Shift, then Fn.

1. The cap says I, and with Fn held the key sends Up. Which part made that happen: the switch, the keyboard, or the computer? How do you know?

2. What did the Fn key and the Shift key send that was different from a letter key?

Quick check

Name: ______________________________

1. When you press a key, the keyboard sends (A) the letter on the cap (B) a code for that key (C) a picture of the letter

2. A layer lets a keyboard (A) send two different codes from one key (B) type faster (C) work without a cable

3. The same keyboard types different characters on a computer set to another language. Explain why.

Answers

QuestionAnswerWhy
1BThe keyboard looks the key up in its keymap and sends a code. The computer chooses the character.
2AWhile Fn is held the keyboard reads a second keymap, so the I key can send the code for Up.
3The computer turns codes into charactersThe keyboard sends the same codes. The computer looks them up in its own keyboard layout setting, and that setting changed.

If your state or umbrella school asks, this lesson covers CSTA 2017 3A-CS-02, CSTA 2017 3A-CS-01.