# Minecraft Turbopad

## Overview

https://youtu.be/Wm7Fsr4yeUE

Use the Macropad to send any command to Minecraft with just one button press. Program twelve custom keys that can run commands or key combos.

CircuitPython makes it simple to customize your Minecraft Turbopad to run any command you like, even initiate latching mouse and key combos, such as auto strip-mining mode.

## Parts
### Adafruit MacroPad RP2040 Starter Kit - 3x4 Keys + Encoder + OLED

[Adafruit MacroPad RP2040 Starter Kit - 3x4 Keys + Encoder + OLED](https://www.adafruit.com/product/5128)
Strap yourself in, we're launching in T-minus 10 seconds...Destination? A new Class M planet called MACROPAD! M here stands for Microcontroller because this 3x4 keyboard controller features the newest technology from the Raspberry Pi sector: say hello to the RP2040. It's a speedy...

Out of Stock
[Buy Now](https://www.adafruit.com/product/5128)
[Related Guides to the Product](https://learn.adafruit.com/products/5128/guides)
![Video of a hand playing with a rainbow-glowing keypad.](https://cdn-shop.adafruit.com/product-videos/640x480/5128-08.jpg)

-or-

### Adafruit MACROPAD RP2040 Bare Bones - 3x4 Keys + Encoder + OLED

[Adafruit MACROPAD RP2040 Bare Bones - 3x4 Keys + Encoder + OLED](https://www.adafruit.com/product/5100)
Strap yourself in, we're launching in T-minus 10 seconds...Destination? A new Class M planet called MACROPAD! M here, stands for Microcontroller because this 3x4 keyboard controller features the newest technology from the Raspberry Pi sector: say hello to the RP2040. It's a speedy...
Out of Stock
[Buy Now](https://www.adafruit.com/product/5100)
[Related Guides to the Product](https://learn.adafruit.com/products/5100/guides)
![Angled shot of MacroPad](https://cdn-shop.adafruit.com/640x480/5100-00.jpg)

### Adafruit MacroPad RP2040 Enclosure + Hardware Add-on Pack

[Adafruit MacroPad RP2040 Enclosure + Hardware Add-on Pack](https://www.adafruit.com/product/5103)
Dress up your Adafruit Macropad with PaintYourDragon's fabulous decorative silkscreen enclosure and hardware kit. You get the two custom PCBs that are cut to act as a protective bottom plate and and a mechanically-stabilizing keyboard plate.

Use the included M3 screws to attach the...

In Stock
[Buy Now](https://www.adafruit.com/product/5103)
[Related Guides to the Product](https://learn.adafruit.com/products/5103/guides)
![Top view of MacroPad add on pack](https://cdn-shop.adafruit.com/640x480/5103-06.jpg)

### Kailh Mechanical Key Switches - Linear Red - 12 Pack

[Kailh Mechanical Key Switches - Linear Red - 12 Pack](https://www.adafruit.com/product/5122)
For crafting your very own custom keyboard, these **&nbsp;Kailh Red Linear mechanical key switches** &nbsp;are deeee-luxe! With smooth actuation and Cherry MX compatibility, they're lovely when you want a&nbsp; **smooth linear&nbsp;** keystroke:

- Type...

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

### Clear Keycaps for MX Compatible Switches - 12-pack

[Clear Keycaps for MX Compatible Switches - 12-pack](https://www.adafruit.com/product/5068)
Here is a **12&nbsp;pack** of Clear DSA keycaps for your next mechanical keyboard or&nbsp;[NeoKey](https://www.adafruit.com/?q=neokey&sort=BestMatch)&nbsp;project. Snap 'em onto any&nbsp; **Cherry MX or compatible switch&nbsp;** to turn your&nbsp;<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/5068)
[Related Guides to the Product](https://learn.adafruit.com/products/5068/guides)
![Group shot of Clear DSA Keycaps for MX Compatible Switches - 12 pack](https://cdn-shop.adafruit.com/640x480/5068-04.jpg)

### Pink and Purple Woven USB A to USB C Cable - 1 meter long

[Pink and Purple Woven USB A to USB C Cable - 1 meter long](https://www.adafruit.com/product/5153)
This cable is not only super-fashionable, with a woven pink and purple Blinka-like pattern, it's also made for USB C for our modernized breakout boards, Feathers, and more.&nbsp;&nbsp;[If you want something just like it but for Micro B, we...](https://www.adafruit.com/product/4111)

Out of Stock
[Buy Now](https://www.adafruit.com/product/5153)
[Related Guides to the Product](https://learn.adafruit.com/products/5153/guides)
![Angled shot of coiled pink and purple USB cable with USB A and USB C connectors.](https://cdn-shop.adafruit.com/640x480/5153-02.jpg)

# Minecraft Turbopad

## 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_macropad_rp2040/)
 **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/103/264/medium800/adafruit_products_MacroPad_boot_reset.jpg?1625068553)

Info: 

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/101/659/original/flash_nuke.uf2?1618945856)
# Minecraft Turbopad

## Macropad Assembly

https://youtu.be/_aW90ufD6X0?t=45

The Macropad features hot-swap sockets for the switches -- gone are the days of having to _commit_ to one type of switch and solder it down! Now, you can plug in your Cherry MX red keyswitches, use them for a while, get bored, decide its time to test out some lubed, filmed, re-sprung Invyr Holy Pandas, and swap them just like that!

## Switches into Plate

First, insert a couple of keyswitches through the keyswitch plate. The plate mechanically connects the switches to each other, which lends some nice lateral stability to the keys.

![circuitpython_mp01.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/450/medium640/circuitpython_mp01.jpg?1626465592)

![circuitpython_mp02.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/451/medium640/circuitpython_mp02.jpg?1626465609)

## Connect to Board

Carefully press the two switches into the switch sockets, being very careful to align the legs so none bend!

![circuitpython_mp03.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/452/medium640/circuitpython_mp03.jpg?1626465642)

![circuitpython_mp04.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/453/medium640/circuitpython_mp04.jpg?1626465661)

## Add Switches

Continue adding switches, being mindful of their orientation.

![circuitpython_mp05.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/454/medium640/circuitpython_mp05.jpg?1626465704)

![circuitpython_mp06.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/455/medium640/circuitpython_mp06.jpg?1626465720)

![](https://cdn-learn.adafruit.com/assets/assets/000/103/456/medium800/circuitpython_mp08.jpg?1626465770)

## Backplate

You can add the optional backplate using four M3 x 6mm screws.

![circuitpython_mp09.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/457/medium640/circuitpython_mp09.jpg?1626465803)

![circuitpython_mp10.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/458/medium640/circuitpython_mp10.jpg?1626465823)

![](https://cdn-learn.adafruit.com/assets/assets/000/103/459/medium800/circuitpython_mp11.jpg?1626465846)

## Keycaps

Now, you can add your keycaps! simply press them onto the keyswitch stems until they are fully seated.

![circuitpython_mp12.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/460/medium640/circuitpython_mp12.jpg?1626465875)

![circuitpython_mp13.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/461/medium640/circuitpython_mp13.jpg?1626465894)

![](https://cdn-learn.adafruit.com/assets/assets/000/103/462/medium800/circuitpython_mp14.jpg?1626465905)

# Minecraft Turbopad

## Code and Use the Minecraft Turbopad

## Text Editor

Adafruit recommends using the **Mu** editor for editing your CircuitPython code. You can get more info in [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, along with a folder full of key configuration files. To get everything you need, click on the&nbsp; **Download Project Bundle** &nbsp;link below, and uncompress the .zip file.

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

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

## Use It

The Minecraft Turbopad acts just like a regular USB keyboard, so you don't need to do anything tricky to enable it -- in fact, just fire up Minecraft and start using it once you're playing! Press a key and the command will run, just like that!

Here's a video of it in action:

https://youtu.be/Wm7Fsr4yeUE

## Customize the Commands

You can switch out the commands to any that you prefer! Here's a pretty comprehensive [list for reference](https://minecraft.fandom.com/wiki/Commands).

The `keymap` dictionary contains all of the commands, per key. For example:

`(0): (AQUA, COMMAND, KEY_MOMENT, [macropad.Keycode.FORWARD_SLASH],          "gamemode creative", [macropad.Keycode.ENTER])`

That is the first entry, so it it triggered by the first (upper left) key on the Macropad. When pressed it will type out `/gamemode creative`. If you wanted to change this to switch you into adventure mode, the line would look like this:

`(0): (AQUA, COMMAND, KEY_MOMENT, [macropad.Keycode.FORWARD_SLASH],          "gamemode adventure", [macropad.Keycode.ENTER])`

## Display Labels

When you customize your key commands, you'll want to update the display labels to match. This code is the list you'll need to change, simply swap in different text -- just keep it short and sweet so it fits on screen!

```auto
label_text = [
    "CREATE", "SURVIV", "SAY",
    "DAY", "NIGHT", "KILL",
    "CLEAR", "RAIN", "THUNDR",
    "BEE", "MINE", "SOUND",
]
```


## Featured Products

### Adafruit MacroPad RP2040 Enclosure + Hardware Add-on Pack

[Adafruit MacroPad RP2040 Enclosure + Hardware Add-on Pack](https://www.adafruit.com/product/5103)
Dress up your Adafruit Macropad with PaintYourDragon's fabulous decorative silkscreen enclosure and hardware kit. You get the two custom PCBs that are cut to act as a protective bottom plate and and a mechanically-stabilizing keyboard plate.

Use the included M3 screws to attach the...

In Stock
[Buy Now](https://www.adafruit.com/product/5103)
[Related Guides to the Product](https://learn.adafruit.com/products/5103/guides)
### Adafruit MACROPAD RP2040 Bare Bones - 3x4 Keys + Encoder + OLED

[Adafruit MACROPAD RP2040 Bare Bones - 3x4 Keys + Encoder + OLED](https://www.adafruit.com/product/5100)
Strap yourself in, we're launching in T-minus 10 seconds...Destination? A new Class M planet called MACROPAD! M here, stands for Microcontroller because this 3x4 keyboard controller features the newest technology from the Raspberry Pi sector: say hello to the RP2040. It's a speedy...
Out of Stock
[Buy Now](https://www.adafruit.com/product/5100)
[Related Guides to the Product](https://learn.adafruit.com/products/5100/guides)
### Adafruit MacroPad RP2040 Starter Kit - 3x4 Keys + Encoder + OLED

[Adafruit MacroPad RP2040 Starter Kit - 3x4 Keys + Encoder + OLED](https://www.adafruit.com/product/5128)
Strap yourself in, we're launching in T-minus 10 seconds...Destination? A new Class M planet called MACROPAD! M here stands for Microcontroller because this 3x4 keyboard controller features the newest technology from the Raspberry Pi sector: say hello to the RP2040. It's a speedy...

Out of Stock
[Buy Now](https://www.adafruit.com/product/5128)
[Related Guides to the Product](https://learn.adafruit.com/products/5128/guides)
### Woven USB Cable with USB Type A to Right Angle USB Type C

[Woven USB Cable with USB Type A to Right Angle USB Type C](https://www.adafruit.com/product/5031)
Some days we're feeling extra fancy here at the 'fruit warehouse, and we have a big soft spot for woven fabric cables. Like, peep [this fully reversible pink/purple Blinka-inspired cable](https://www.adafruit.com/product/4111)&nbsp;or <a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/5031)
[Related Guides to the Product](https://learn.adafruit.com/products/5031/guides)
### Kailh Mechanical Key Switches - 10 packs - Cherry MX Compatible

[Kailh Mechanical Key Switches - 10 packs - Cherry MX Compatible](https://www.adafruit.com/product/4996)
For crafting your very own custom keyboard, these **&nbsp;Kailh mechanical key switches** &nbsp;are deeee-luxe!

Come&nbsp;in a pack of 10 switches, plenty to make a small keyboard, or grab a few packs to build a full keyboard.

- Use these with our&nbsp;<a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/4996)
[Related Guides to the Product](https://learn.adafruit.com/products/4996/guides)
### Clear Keycaps for MX Compatible Switches - 12-pack

[Clear Keycaps for MX Compatible Switches - 12-pack](https://www.adafruit.com/product/5068)
Here is a **12&nbsp;pack** of Clear DSA keycaps for your next mechanical keyboard or&nbsp;[NeoKey](https://www.adafruit.com/?q=neokey&sort=BestMatch)&nbsp;project. Snap 'em onto any&nbsp; **Cherry MX or compatible switch&nbsp;** to turn your&nbsp;<a...></a...>

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

## Related Guides

- [Adafruit MacroPad RP2040](https://learn.adafruit.com/adafruit-macropad-rp2040.md)
- [An Introduction to RP2040 PIO with CircuitPython](https://learn.adafruit.com/intro-to-rp2040-pio-with-circuitpython.md)
- [MacroPad Summer Olympics Hotkeys](https://learn.adafruit.com/macropad-olympic-hotkeys.md)
- [MACROPAD Hotkeys](https://learn.adafruit.com/macropad-hotkeys.md)
- [Ableton Live MacroPad Launcher](https://learn.adafruit.com/ableton-live-macropad-launcher.md)
- [Scrambled Number Security Keypad](https://learn.adafruit.com/scrambled-number-security-keypad.md)
- [3D Printed Stand for MacroPad RP2040](https://learn.adafruit.com/3d-printed-stand-for-macropad-rp2040.md)
- [MacroPad Remote Procedure Calls over USB to Control Home Assistant](https://learn.adafruit.com/macropad-remote-procedure-calls-over-usb-to-control-home-assistant.md)
- [MP3 Playback on RP2040 with CircuitPython](https://learn.adafruit.com/mp3-playback-rp2040.md)
- [Using QMK on RP2040 Microcontrollers](https://learn.adafruit.com/using-qmk-on-rp2040-microcontrollers.md)
- [MacroPad 2FA TOTP Authentication Friend](https://learn.adafruit.com/macropad-2fa-totp-authentication-friend.md)
- [AdaBox 019](https://learn.adafruit.com/adabox019.md)
- [Dragon Drop: a CircuitPython Game for MacroPad](https://learn.adafruit.com/dragon-drop-a-circuitpython-game-for-macropad.md)
- [DIY Decorative Resin Keycaps](https://learn.adafruit.com/diy-decorative-resin-keycaps.md)
- [Capturing Camera Images with CircuitPython](https://learn.adafruit.com/capturing-camera-images-with-circuitpython.md)
