In this project, we will use the CREATOR Kit to design and build a Minecraft controller. This first version of the controller will use the accelerometer to control where your character, Steve, is looking. In addition, we'll use four buttons to control Steve's movements forward, backwards, left and right. And we'll add two extra buttons as well — a left button to allow Steve to smash and a right button that will make Steve jump.

The hardware setup for this project includes the accelerometer and four buttons. For more information about setting up the accelerometer, refer back to the project. For more information about setting up the buttons, refer back to the project.

In the code we write below, we will assume that the buttons are attached the following GPIOs:

This is what your hardware setup should look like (note that we've added some extra wires to keep the breadboard looking clean and to make the buttons easily accessible):

The software for this project will bring together our project with the and projects. The initialization code will be similar to those projects.

Here is what the code for this project should look like (where the new code we'll discuss below is highlighted with red arrows):

The new additions we've made to the code (and highlighted above) are:

Give your controller a try and see how it works. In our upcoming projects, we'll improve the code and add more controller functionality.

  1. Add another button (or remap an existing button) to allow Steve to crouch at the press of the button.

  2. Modify the code so that pressing and holding a button doesn't work — instead, have Steve only move a small amount when a button is pressed.

  3. Modify the code so that Steve's movements are based on the accelerometer and where he looks are controlled by the buttons.