Lesson 6: CPX as a Keyboard

Table of Contents

  1. Lesson 6.1: Making a Programmable Keyboard
    1. Lesson 6.1 Code
  2. Lesson 6.2: The CPX as a Media Player Controller
    1. Lesson 6.2 Code
  3. Lesson 6.3: Accelerometer Keyboard
    1. Lesson 6.3 Code
  4. Project Examples
  5. Next Lesson

In Lesson 6 of our CPX series, we will learn how to use the CPX as a programmable keyboard. We’ll begin by making the A and B buttons into keyboard presses and then create increasingly fun and interesting keyboards, including a media controller keyboard (Lesson 6.2) and an accelerometer-based keyboard (Lesson 6.3).

Note: there is some overlapping content with Lesson 5.3: Making a Capacitive Keyboard but we wanted to start from the beginning here and grow outward! So, you should be able to complete these lessons even if you have not completed Lesson 5.3.

Lesson 6.1: Making a Programmable Keyboard

In this lesson, we will show how to use the CPX as a programmable keyboard

Lesson 6.1 Code

Here’s a link to the MakeCode we wrote in this lesson:

Lesson 6.2: The CPX as a Media Player Controller

In this lesson, we will show how to use the media key functionality to control Spotify and YouTube.

Lesson 6.2 Code

Here’s the MakeCode we created during this lesson, which shows how to use media key presses to control Spotify and YouTube.

Lesson 6.3: Accelerometer Keyboard

In this lesson, we show how to translate the accelerometer signal to key presses.

Lesson 6.3 Code

As promised, here’s a different take (code link) on the real-time tilt keyboard that we previously created but is different from the solution we came up with during the video.

Project Examples

All project examples below provide tutorials with example MakeCode code.

Next Lesson

In the next lesson, we’ll extend our work to build a custom interactive mouse.

Previous: Capacitive Sensing Next: CPX as a Mouse


This website was developed by Professor Jon E. Froehlich and the Makeability Lab using Just the Docs. If you found the website useful or use it in your teaching, we'd love to hear from you: jonf@cs.uw.edu. This website and all code is open source (website GitHub, Arduino GitHub, p5js GitHub). You can find the MakeabilityLab_Arduino_Library here. Found an error? File a GitHub Issue.