# DOOM Keeb

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/132/481/medium800/hacks_doomthumb.jpg?1726679381)

https://youtu.be/M1-oW-84L1E

Play DOOM directly from the flash memory of a KB2040 embedded INSIDE THE KEYBOARD!

Press the custom DOOM button to launch!

A secret USB hub mounted inside the keyboard does the trick of allowing both the keyboard and the Adafruit KB2040 KeeBoar connect to your Windows computer over a single USB cable. CircuitPython watches the NeoKey button and launches a tiny ZDoom.exe when pressed. The host computer doesn't need anything installed at all!

DoooooOOOOM

Featured
### Adafruit KB2040 - RP2040 Kee Boar Driver

[Adafruit KB2040 - RP2040 Kee Boar Driver](https://www.adafruit.com/product/5302)
A wild Kee Boar appears! It’s a shiny **KB2040**! An Arduino Pro Micro-shaped board for Keebs with RP2040. (#keeblife 4 evah) A lot of folks like using Adafruit parts for their Keeb builds – but with the ItsyBitsy not being pin-compatible with the Pro Micro pinout, it...

In Stock
[Buy Now](https://www.adafruit.com/product/5302)
[Related Guides to the Product](https://learn.adafruit.com/products/5302/guides)
![Angled shot of short black microcontroller.](https://cdn-shop.adafruit.com/640x480/5302-07.jpg)

Featured
### Adafruit CH334F Mini 2-Port USB Hub Breakout

[Adafruit CH334F Mini 2-Port USB Hub Breakout](https://www.adafruit.com/product/5999)
Sometimes, you've got something with a USB host, like an embedded Linux board, and you want to connect more than one thing. Or maybe you want to turn something like a keyboard into a multi-device USB peripheral. The&nbsp; **Adafruit CH334F Mini 2-Port USB Hub...**

In Stock
[Buy Now](https://www.adafruit.com/product/5999)
[Related Guides to the Product](https://learn.adafruit.com/products/5999/guides)
![Angled shot of black, square-shaped USB breakout board.](https://cdn-shop.adafruit.com/640x480/5999-04.jpg)

Featured
### NeoKey Socket Breakout for Mechanical Key Switches with NeoPixel

[NeoKey Socket Breakout for Mechanical Key Switches with NeoPixel](https://www.adafruit.com/product/4978)
The only thing better than a nice mechanical key, is one that also can glow any color of the rainbow - and that's what the **Adafruit NeoKey Breakout** will let you do! This little 0.75" x 0.85" PCB can fit one **Cherry MX or compatible switch** and make...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4978)
[Related Guides to the Product](https://learn.adafruit.com/products/4978/guides)
![Video of breakout PCB installed on breadboard with key caps and switches. A finger reaches down to press the keys which light up rainbow colors.](https://cdn-shop.adafruit.com/product-videos/640x480/4978-07.jpg)

Featured
### Kailh Mechanical Key Switch - Clicky Blue - Single Piece

[Kailh Mechanical Key Switch - Clicky Blue - Single Piece](https://www.adafruit.com/product/5123)
For crafting your very own custom keyboard, a **&nbsp;Kailh&nbsp;Blue Linear mechanical key switches** &nbsp;is deeee-luxe! With smooth actuation and Cherry MX compatibility, they're lovely when you want a **clicky tactile** keystroke with a snappy feel and an...

In Stock
[Buy Now](https://www.adafruit.com/product/5123)
[Related Guides to the Product](https://learn.adafruit.com/products/5123/guides)
![Single shot of 12 pack Blue Kailh Mechanical Key Switches ](https://cdn-shop.adafruit.com/640x480/5123-00.jpg)

Featured
### Relegendable Plastic Keycaps for MX Compatible Switches 10 pack

[Relegendable Plastic Keycaps for MX Compatible Switches 10 pack](https://www.adafruit.com/product/5039)
Get ready&nbsp;to customize your keeb with a 10&nbsp;pack of two-part plastic keycaps for your next mechanical keyboard or&nbsp;[NeoKey](https://www.adafruit.com/?q=neokey&sort=BestMatch)&nbsp;project.

Each keycap comes with a off-white base and a clear cover piece. You...

In Stock
[Buy Now](https://www.adafruit.com/product/5039)
[Related Guides to the Product](https://learn.adafruit.com/products/5039/guides)
![Angled shot of ten white plastic keycaps.](https://cdn-shop.adafruit.com/640x480/5039-08.jpg)

Featured
### USB Type A to Type C Cable - approx 1 meter / 3 ft long

[USB Type A to Type C Cable - approx 1 meter / 3 ft long](https://www.adafruit.com/product/4474)
As technology changes and adapts, so does Adafruit. This&nbsp;&nbsp; **USB Type A to Type C** cable will help you with the transition to USB C, even if you're still totin' around a USB Type A hub, computer or laptop.

USB C is the latest industry-standard connector for...

In Stock
[Buy Now](https://www.adafruit.com/product/4474)
[Related Guides to the Product](https://learn.adafruit.com/products/4474/guides)
![Angled shot of a coiled black, USB-C to USB-A cable.](https://cdn-shop.adafruit.com/640x480/4474-02.jpg)

### Mechanical Keyboard

A keyboard with enough space inside to tuck away the hub and microcontroller, plus an added special key. Bonus points for embedded trackpad for all-in-one emergency use.

I used the Cherry Touchboard which is available from [DigiKey](https://www.digikey.com/en/products/detail/cherry-americas-llc/G80-11900LUMEU-2/1144722)

![hacks_713g_nplS3L._AC_SL1500_.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/244/medium640/hacks_713g_nplS3L._AC_SL1500_.jpg?1725989784)

# DOOM Keeb

## Build the DOOM Keeb

![](https://cdn-learn.adafruit.com/assets/assets/000/132/396/medium800/hacks_DK-1211.jpg?1726615939)

The DOOM Keeb will only have a single USB cable to plug into your computer. That cable runs to the CH334F mini USB hub's upstream port.

The keyboard's built-in controller will be plugged into one of the hub's downstream ports, and the KB2040 the other.

The KB2040 will have a NeoKey breakout plugged into it so that it can launch the ZDoom.exe file that's stored on the KB2040's flash memory when pressed.

![](https://cdn-learn.adafruit.com/assets/assets/000/132/407/medium800/hacks_doom_keeb_3_fritz.jpg?1726619367)

## Disassemble&nbsp;

Remove the screws holding the keyboard together and open the case. Separate the parts.

![](https://cdn-learn.adafruit.com/assets/assets/000/132/397/medium800/hacks_DK-1214.jpg?1726615952)

## Disconnect Keyboard Cable

The USB cable is plugged into the keyboard controller with a small connector.&nbsp;

Carefully unplug.

![hacks_DK-1215.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/398/medium640/hacks_DK-1215.jpg?1726616006)

![hacks_DK-1217.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/399/medium640/hacks_DK-1217.jpg?1726616015)

## Cut the Cord

Cut the original cord about four inches from the interior connector -- we'll reuse that in a moment.

Strip some insulation from the USB cable as shown.

![hacks_DK-1222.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/400/medium640/hacks_DK-1222.jpg?1726616091)

![hacks_DK-1223.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/401/medium640/hacks_DK-1223.jpg?1726616103)

## USB Cable to Hub

Strip and tin the four USB wires.

Solder these to the upstream port connections on the hub (the set of pads opposite of the USB C jack):

- **Red to HOST PORT 5V**
- **Black to HOST PORT GND**
- **Green to HOST PORT D+**
- **White to HOST PORT D-**

![hacks_DK-1224.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/402/medium640/hacks_DK-1224.jpg?1726616210)

![hacks_DK-1225.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/403/medium640/hacks_DK-1225.jpg?1726616216)

![hacks_DK-1226.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/404/medium640/hacks_DK-1226.jpg?1726616223)

You've now got a two-port USB hub embedded in your keyboard case!

![](https://cdn-learn.adafruit.com/assets/assets/000/132/408/medium800/hacks_DK-1228.jpg?1726620098)

## Keyboard Connection Cable

Remove the outer insulation and shielding from the keyboard cable you cut earlier.

Strip and tin the ends and then solder them to the mini USB hub's downstream port 1 as shown.

- **black** to&nbsp; **USB hub PORT1 GND**
- **red** &nbsp;to **USB hub PORT1 5V**
- **green** to&nbsp; **USB hub PORT1 D+**
- **white** to&nbsp; **USB hub PORT1 D-**

![hacks_DK-1244.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/409/medium640/hacks_DK-1244.jpg?1726620153)

![hacks_DK-1245.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/410/medium640/hacks_DK-1245.jpg?1726620166)

![hacks_DK-1247.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/411/medium640/hacks_DK-1247.jpg?1726620266)

![](https://cdn-learn.adafruit.com/assets/assets/000/132/413/medium800/hacks_DK-1248.jpg?1726620274)

The white connector can be plugged into the keyboard's controller once we're ready for testing.

## NeoKey Wiring

Cut an 8" length each of four wires for the NeoKey to connect to the KB2040.

Strip and tin the wires, then solder to the NeoKey and the KB2040:

- **black&nbsp;** from **NeoKey**  **-**** &nbsp; **to** KB2040 **&nbsp;** GND**
- **red&nbsp;** from **NeoKey**  **+&nbsp;** to **KB2040** &nbsp; **3V**
- **blue** from **NeoKey** &nbsp; **S+** to **KB2040** &nbsp; **A1**
- **yellow&nbsp;** from **NeoKey** &nbsp;**IN (**NeoPixel In**)** to **KB2040** &nbsp; **A2**

Also solder a short black wire from **NeoKey** &nbsp; **S-** to **NeoKey -&nbsp;** (this is what sends the switch to ground when it is in the unpressed state).

![hacks_DK-1249.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/416/medium640/hacks_DK-1249.jpg?1726620374)

![hacks_DK-1252.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/417/medium640/hacks_DK-1252.jpg?1726620463)

![hacks_DK-1253.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/419/medium640/hacks_DK-1253.jpg?1726620836)

![](https://cdn-learn.adafruit.com/assets/assets/000/132/424/medium800/hacks_DK-1255.jpg?1726621207)

![](https://cdn-learn.adafruit.com/assets/assets/000/132/428/medium800/hacks_DK-1258.jpg?1726621270)

## KB2040 Wiring

Cut an 5" length each of four wires for the KB2040 to connect to the hub's downstream port 2 connections.

Strip and tin the wires, then solder:

- **black** from **KB2040 GND** to **USB hub PORT2 GND**
- **red** from **KB2040 RAW** (5V) to **USB hub PORT2 5V**
- **green&nbsp;** from&nbsp; **KB2040 D+&nbsp;** to&nbsp; **USB hub PORT2 D+**
- **white&nbsp;** from&nbsp; **KB2040 D-&nbsp;** to&nbsp; **USB hub PORT2 D-**

![hacks_DK-1259.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/429/medium640/hacks_DK-1259.jpg?1726621308)

![hacks_DK-1260.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/430/medium640/hacks_DK-1260.jpg?1726621315)

![hacks_DK-1262.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/431/medium640/hacks_DK-1262.jpg?1726621379)

## Connection Test

Plug the which keyboard driver connection back in so the keyboard can be enumerated on the hub.

Plug the USB cable into your computer -- the three green LEDs will light up to show that the hub has power and the two devices plugged into it have enumerated.

The KB2040's green status LED will light up, and the NeoKey will light up red.

![](https://cdn-learn.adafruit.com/assets/assets/000/132/432/medium800/hacks_DK-1267.jpg?1726621927)

![](https://cdn-learn.adafruit.com/assets/assets/000/132/437/medium800/hacks_DK-1269.jpg?1726622048)

## Case Mod

In order to add the DOOM launch key properly, you'll need to cut a hole in the case right under the existing ESC key.

![](https://cdn-learn.adafruit.com/assets/assets/000/132/441/medium800/hacks_DK-1318.jpg?1726629809)

## Measure & Mark

Measure the ESC key hole and mark the same size just below it -- calipers can be handy for this.

&nbsp;

![hacks_DK-1321.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/444/medium640/hacks_DK-1321.jpg?1726629848)

![hacks_DK-1323.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/445/medium640/hacks_DK-1323.jpg?1726629891)

![](https://cdn-learn.adafruit.com/assets/assets/000/132/449/medium800/hacks_DK-1324.jpg?1726629924)

## Score, Drill, Cut, File

Use a utility knife and straight edge to score the lines a bit deeper than the initial scribe lines.

You can drill the corners, too, then continue to cut or use a coping saw to remove the rest of the material.

Use a small file to clean up the edges, and round over a bevel to match the existing edges.

![hacks_DK-1327.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/452/medium640/hacks_DK-1327.jpg?1726629973)

![hacks_DK-1329.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/453/medium640/hacks_DK-1329.jpg?1726629988)

![hacks_DK-1331.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/454/medium640/hacks_DK-1331.jpg?1726630139)

![](https://cdn-learn.adafruit.com/assets/assets/000/132/460/medium800/hacks_DK-1332.jpg?1726630170)

## Key Fitting

Use some thick double-stick tape or Uglu dots to place the key lightly in place.

Line up the key more precisely with the top of the case in place, then press the key more securely.

Remove the case top and use hot glue to more securely afix the NeoKey breakout to the keyboard PCB.

![hacks_DK-1338.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/464/medium640/hacks_DK-1338.jpg?1726630198)

![hacks_DK-1334.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/465/medium640/hacks_DK-1334.jpg?1726630311)

![hacks_DK-1340.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/466/medium640/hacks_DK-1340.jpg?1726630331)

![hacks_DK-1341.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/467/medium640/hacks_DK-1341.jpg?1726630348)

![](https://cdn-learn.adafruit.com/assets/assets/000/132/470/medium800/hacks_DK-1335.jpg?1726630380)

You can now close up the keyboard case fully and screw it back together.

## Custom Keycap Cover

You can print a 1" square keycap cover and fold it to fit inside the re-legendable keycaps as shown.

![hacks_DK-1426.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/482/medium640/hacks_DK-1426.jpg?1726679616)

![hacks_DK-1427.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/483/medium640/hacks_DK-1427.jpg?1726679628)

![hacks_DK-1428.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/484/medium640/hacks_DK-1428.jpg?1726679634)

![hacks_DK-1430.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/485/medium640/hacks_DK-1430.jpg?1726679641)

![](https://cdn-learn.adafruit.com/assets/assets/000/132/488/medium800/hacks_DK-1432.jpg?1726679699)

![](https://cdn-learn.adafruit.com/assets/assets/000/132/496/medium800/hacks_DK-1433b.jpg?1726680050)

# DOOM Keeb

## CircuitPython

[CircuitPython](https://github.com/adafruit/circuitpython) is a derivative of [MicroPython](https://micropython.org) designed to simplify experimentation and education on low-cost microcontrollers. It makes it easier than ever to get prototyping by requiring no upfront desktop software downloads. Simply copy and edit files on the **CIRCUITPY** drive to iterate.

## CircuitPython Quickstart

Follow this step-by-step to quickly get CircuitPython running on your board.

[Download the latest version of CircuitPython for this board via circuitpython.org](https://circuitpython.org/board/adafruit_kb2040/)
 **Click the link above to download the latest CircuitPython UF2 file.**

Save it wherever is convenient for you.

![install_circuitpython_on_rp2040_RP2040_UF2_downloaded.jpg](https://cdn-learn.adafruit.com/assets/assets/000/101/655/medium640/install_circuitpython_on_rp2040_RP2040_UF2_downloaded.jpg?1618943202)

![](https://cdn-learn.adafruit.com/assets/assets/000/108/852/medium800/adafruit_products_KeeBoar_boot_reset.jpg?1644515196)

To enter the bootloader, hold down the **BOOT/**** BOOTSEL button**(highlighted in red above), and while continuing to hold it (don't let go!), press and release the**reset button**(highlighted in red or blue above).&nbsp;**Continue to hold the BOOT/BOOTSEL button until the RPI-RP2 drive appears!**

If the drive does not appear, release all the buttons, and then repeat the process above.

You can also start with your board unplugged from USB, press and hold the BOOTSEL button (highlighted in red above), continue to hold it while plugging it into USB, and wait for the drive to appear before releasing the button.

A lot of people end up using charge-only USB cables and it is very frustrating! **Make sure you have a USB cable you know is good for data sync.**

You will see a new disk drive appear called **RPI-RP2**.

&nbsp;

Drag the **adafruit\_circuitpython\_etc.uf2** file to **RPI-RP2.**

![install_circuitpython_on_rp2040_RP2040_bootloader_drive.jpg](https://cdn-learn.adafruit.com/assets/assets/000/101/656/medium640/install_circuitpython_on_rp2040_RP2040_bootloader_drive.jpg?1618943666)

![install_circuitpython_on_rp2040_RP2040_drag_UF2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/101/657/medium640/install_circuitpython_on_rp2040_RP2040_drag_UF2.jpg?1618943674)

The **RPI-RP2** drive will disappear and a new disk drive called **CIRCUITPY** will appear.

That's it, you're done! :)

![install_circuitpython_on_rp2040_RP2040_CIRCUITPY.jpg](https://cdn-learn.adafruit.com/assets/assets/000/101/658/medium640/install_circuitpython_on_rp2040_RP2040_CIRCUITPY.jpg?1618943864)

## Safe Mode

You want to edit your **code.py** or modify the files on your **CIRCUITPY** drive, but find that you can't. Perhaps your board has gotten into a state where **CIRCUITPY** is read-only. You may have turned off the **CIRCUITPY** drive altogether. Whatever the reason, safe mode can help.

Safe mode in CircuitPython does not run any user code on startup, and disables auto-reload. This means a few things. First, safe mode _bypasses any code in_ **boot.py** (where you can set **CIRCUITPY** read-only or turn it off completely). Second, _it does not run the code in_ **code.py**. And finally, _it does not automatically soft-reload when data is written to the_ **CIRCUITPY** _drive_.

Therefore, whatever you may have done to put your board in a non-interactive state, safe mode gives you the opportunity to correct it without losing all of the data on the **CIRCUITPY** drive.

### Entering Safe Mode
To enter safe mode when using CircuitPython, plug in your board or hit reset (highlighted in red above). Immediately after the board starts up or resets, it waits 1000ms. On some boards, the onboard status LED (highlighted in green above) will blink yellow during that time. If you press reset during that 1000ms, the board will start up in safe mode. It can be difficult to react to the yellow LED, so you may want to think of it simply as a slow double click of the reset button. (Remember, a fast double click of reset enters the bootloader.)

### In Safe Mode

If you successfully enter safe mode on CircuitPython, the LED will intermittently blink yellow three times.

If you connect to the serial console, you'll find the following message.

```terminal
Auto-reload is off.
Running in safe mode! Not running saved code.

CircuitPython is in safe mode because you pressed the reset button during boot. Press again to exit safe mode.

Press any key to enter the REPL. Use CTRL-D to reload.
```

You can now edit the contents of the **CIRCUITPY** drive. Remember, _your code will not run until you press the reset button, or unplug and plug in your board, to get out of safe mode._

## Flash Resetting UF2

If your board ever gets into a really _weird_ state and CIRCUITPY doesn't show up as a disk drive after installing CircuitPython, try loading this 'nuke' UF2 to RPI-RP2. which will do a 'deep clean' on your Flash Memory. **You will lose all the files on the board** , but at least you'll be able to revive it! After loading this UF2, follow the steps above to re-install CircuitPython.

[Download flash erasing "nuke" UF2](https://cdn-learn.adafruit.com/assets/assets/000/145/511/original/nuke_universal.uf2?1786537992)
# DOOM Keeb

## Code the DOOM Keeb

## Text Editor

Adafruit recommends using the&nbsp; **Mu** &nbsp;editor for editing your CircuitPython code. You can get more info in&nbsp;[this guide](https://learn.adafruit.com/welcome-to-circuitpython/installing-mu-editor).

Alternatively, you can use any text editor that saves simple text files

## Download the Project Bundle

Your project will use a specific set of CircuitPython libraries, and the&nbsp; **code.py** &nbsp;file. To get everything you need, click on the&nbsp; **Download Project Bundle** &nbsp;link below, and uncompress the .zip file.

Plug your Kee Boar board into your computer with a known good USB cable with both data and power wires. It should show up as a thumb drive in your File Explorer or Finder (depending on your operating system) named&nbsp; **CIRCUITPY**.

Drag the contents of the uncompressed bundle directory onto your Key Boar board&nbsp; **CIRCUITPY** &nbsp;drive, replacing any existing files or directories with the same names, and adding any new ones that are necessary.

![doom](https://adafruit.github.io/Adafruit_Learning_System_Guides/DOOM_Keeb.png )

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/DOOM_Keeb/code.py

```auto
import time
import board
from digitalio import DigitalInOut, Direction
import keypad
import neopixel
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
```

## Button and LED Setup

- **Button** : Connected to pin `A1`. This button will be used to trigger the DOOM launch.
- **Keyboard Object** : Creates a virtual keyboard to send keystrokes to the PC.
- **LED** : On-board LED is turned on initially.
- **NeoPixel** : A single NeoPixel LED is used for visual feedback.

## How the Code Works

When you press the button connected to `board.A1`, the script will use the virtual keyboard to open the Run dialog on a Windows PC, execute a PowerShell command to locate and launch `zdoom.exe`, and provide visual feedback through the NeoPixel LED. The LED turns bright red when the button is pressed, and dims when it is released.

### Imports and Setup

- **`time`** : For delays in the script.
- **`board`** : Provides access to board-specific pins.
- **`digitalio`** : For controlling digital input/output pins.
- **`keypad`** : To handle button presses.
- **`neopixel`** : To control the NeoPixel LED.
- **`usb_hid`** : For USB HID devices.
- **`adafruit_hid`** : Libraries for emulating keyboard input.

```auto
keys = keypad.Keys((board.A1,), value_when_pressed=False, pull=True)
kbd = Keyboard(usb_hid.devices)
layout = KeyboardLayoutUS(kbd)
led = DigitalInOut(board.D13)
led.direction = Direction.OUTPUT
led.value = True
pixel = neopixel.NeoPixel(board.A2, 1, auto_write=False, brightness=1.0)
pixel.fill(0x440000)
pixel.show()
```

### Function to Launch DOOM

- **Open Run Dialog** : Sends `GUI+R` (Windows key + R) to open the Run dialog.
- **Powershell Command** : Uses PowerShell to search for the `zdoom.exe` file in a specific directory (`CIRCUITPY/zdoom`).
- **Launch DOOM** : If the file is found, it starts the DOOM executable.

```auto
def launch_terminal():
    kbd.send(Keycode.GUI, Keycode.R)
    time.sleep(0.25)
    layout.write("powershell -c \"& { gwmi win32_logicaldisk -f 'DriveType=2' | % { try { $p = $_.DeviceID + 'zdoom\\zdoom.exe'; if (Test-Path $p) { Start-Process $p; break } } catch {} } }\"")
    time.sleep(0.25)
    kbd.send(Keycode.ENTER)
    time.sleep(2)
```

### Main Loop

- **Check for Key Press** : Continuously checks if the button is pressed.
- **LED Feedback** : Changes the NeoPixel color to indicate whether the button is pressed (bright red) or released (dim red).
- **Launch DOOM** : Calls `launch_terminal()` when the button is pressed.

```auto
while True:
    event = keys.events.get()
    if event:
        if event.pressed:
            pixel.fill(0xff0000)
            pixel.show()
            launch_terminal()
        if event.released:
            pixel.fill(0x440000)
            pixel.show()
```

# DOOM Keeb

## Play DOOM

To play DOOM, plug in the keyboard -- after a moment it and the **CIRCUITPY** drive will be recognized and the DOOM key will light up.

Press the DOOM key to launch, then just wait a few seconds for it to load.

Now you're ready to play!

![](https://cdn-learn.adafruit.com/assets/assets/000/132/507/medium800thumb/hacks_doomkeeb_demo.jpg?1726684966)

![](https://cdn-learn.adafruit.com/assets/assets/000/132/506/medium800/hacks_DK-1453.jpg?1726680195)


## Guide Products

### Adafruit KB2040 - RP2040 Kee Boar Driver

[Adafruit KB2040 - RP2040 Kee Boar Driver](https://www.adafruit.com/product/5302)
A wild Kee Boar appears! It’s a shiny **KB2040**! An Arduino Pro Micro-shaped board for Keebs with RP2040. (#keeblife 4 evah) A lot of folks like using Adafruit parts for their Keeb builds – but with the ItsyBitsy not being pin-compatible with the Pro Micro pinout, it...

In Stock
[Buy Now](https://www.adafruit.com/product/5302)
[Related Guides to the Product](https://learn.adafruit.com/products/5302/guides)
### Adafruit CH334F Mini 2-Port USB Hub Breakout

[Adafruit CH334F Mini 2-Port USB Hub Breakout](https://www.adafruit.com/product/5999)
Sometimes, you've got something with a USB host, like an embedded Linux board, and you want to connect more than one thing. Or maybe you want to turn something like a keyboard into a multi-device USB peripheral. The&nbsp; **Adafruit CH334F Mini 2-Port USB Hub...**

In Stock
[Buy Now](https://www.adafruit.com/product/5999)
[Related Guides to the Product](https://learn.adafruit.com/products/5999/guides)
### NeoKey Socket Breakout for Mechanical Key Switches with NeoPixel

[NeoKey Socket Breakout for Mechanical Key Switches with NeoPixel](https://www.adafruit.com/product/4978)
The only thing better than a nice mechanical key, is one that also can glow any color of the rainbow - and that's what the **Adafruit NeoKey Breakout** will let you do! This little 0.75" x 0.85" PCB can fit one **Cherry MX or compatible switch** and make...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4978)
[Related Guides to the Product](https://learn.adafruit.com/products/4978/guides)
### Kailh Mechanical Key Switch - Clicky Blue - Single Piece

[Kailh Mechanical Key Switch - Clicky Blue - Single Piece](https://www.adafruit.com/product/5123)
For crafting your very own custom keyboard, a **&nbsp;Kailh&nbsp;Blue Linear mechanical key switches** &nbsp;is deeee-luxe! With smooth actuation and Cherry MX compatibility, they're lovely when you want a **clicky tactile** keystroke with a snappy feel and an...

In Stock
[Buy Now](https://www.adafruit.com/product/5123)
[Related Guides to the Product](https://learn.adafruit.com/products/5123/guides)
### Relegendable Plastic Keycaps for MX Compatible Switches 10 pack

[Relegendable Plastic Keycaps for MX Compatible Switches 10 pack](https://www.adafruit.com/product/5039)
Get ready&nbsp;to customize your keeb with a 10&nbsp;pack of two-part plastic keycaps for your next mechanical keyboard or&nbsp;[NeoKey](https://www.adafruit.com/?q=neokey&sort=BestMatch)&nbsp;project.

Each keycap comes with a off-white base and a clear cover piece. You...

In Stock
[Buy Now](https://www.adafruit.com/product/5039)
[Related Guides to the Product](https://learn.adafruit.com/products/5039/guides)
### USB Type A to Type C Cable - approx 1 meter / 3 ft long

[USB Type A to Type C Cable - approx 1 meter / 3 ft long](https://www.adafruit.com/product/4474)
As technology changes and adapts, so does Adafruit. This&nbsp;&nbsp; **USB Type A to Type C** cable will help you with the transition to USB C, even if you're still totin' around a USB Type A hub, computer or laptop.

USB C is the latest industry-standard connector for...

In Stock
[Buy Now](https://www.adafruit.com/product/4474)
[Related Guides to the Product](https://learn.adafruit.com/products/4474/guides)

## Related Guides

- [Adafruit KB2040](https://learn.adafruit.com/adafruit-kb2040.md)
- [NeoKey Socket Breakout with NeoPixel for MX and CHOC Key Switches](https://learn.adafruit.com/neokey-breakout.md)
- [Adafruit CH334F Mini USB Hub Breakouts](https://learn.adafruit.com/adafruit-ch334f-mini-4-port-usb-hub-breakout.md)
- [WiFi Jellyfish Lantern with WLED](https://learn.adafruit.com/wifi-jellyfish-lantern-with-wled.md)
- [Desk Calculator with CircuitPython](https://learn.adafruit.com/desk-calculator-with-circuitpython.md)
- [Return to The Matrix with the Metro RP2350 or Fruit Jam](https://learn.adafruit.com/return-to-the-matrix-with-the-metro-rp2350.md)
- [RP2040 RunCPM Emulator with USB Keyboard & HDMI screen](https://learn.adafruit.com/rp2040-runcpm-emulator-with-usb-keyboard-hdmi-screen.md)
- [Holiday Card Maker on Fruit Jam](https://learn.adafruit.com/holiday-card-maker-on-fruit-jam.md)
- [Walkmp3rson: Personal MP3 'Tape' Player](https://learn.adafruit.com/walkmp3rson-personal-mp3-tape-player.md)
- [Which CircuitPython Board is Right for You?](https://learn.adafruit.com/choose-your-circuitpython-board.md)
- [Fruit Jam OS](https://learn.adafruit.com/fruit-jam-os.md)
- [MagTag Google Calendar Event Display](https://learn.adafruit.com/magtag-google-calendar-event-display.md)
- [PyPortal Pet Planter with Adafruit IO](https://learn.adafruit.com/pyportal-pet-planter-with-adafruit-io.md)
- [CircuitPython on the Xteink X4 eReader](https://learn.adafruit.com/circuitpython-on-the-xteink-x4-ereader.md)
- [PB Gherkin 30% keyboard with KMK, CircuitPython, & KB2040](https://learn.adafruit.com/pb-gherkhin-30-keyboard-with-kmk-circuitpython-kb2040.md)
- [Scroll an SMS Text Message on your RGB Matrix](https://learn.adafruit.com/scroll-an-sms-text-message-on-your-rgb-matrix.md)
- [Demofruit: Demoscene for Fruit Jam](https://learn.adafruit.com/demo-jam-fruit-scene.md)
- [USB MIDI Host2Host](https://learn.adafruit.com/usb-midi-host2host.md)
