By default, the switches will send the following keystrokes when pressed:

  • Switch 1 = CONTROL
  • Switch 2 = ALT
  • Switch 3 = DELETE

Each switch's LED will light when pressed, its corresponding color will display on the Circuit Playground's built-in neopixel LEDs, and colors will mix when pressed simultaneously.

Customize it

You can easily change what keystrokes are sent from each switch by modifying the code.  Check out the following line from the code we uploaded in the previous step:

buttonkeys = [Keycode.CONTROL, Keycode.ALT, Keycode.DELETE]

Change the above keycodes to whatever you like by finding your preferred keycode in the adafruit_hid.keycode reference.

For example: If you want to use the switches to open the Force Quit Applications window on a Mac (Command-Option-Escape), change the line to:

buttonkeys = [Keycode.GUI, Keycode.ALT, Keycode.ESCAPE]

Of course, since the switches are simple digital inputs on the Circuit Playground, you can use them as pretty much anything – sound triggers, game buzzers, robotics controller, etc. 

Really - what electronics couldn't benefit from giant button input?

This guide was first published on Jan 23, 2018. It was last updated on Jul 15, 2024.

This page (Use it) was last updated on Mar 08, 2024.

Text editor powered by tinymce.