Introduction: How to Make a Gameboy/ Game Controller With a Arduino Leonardo

Hi everyone in this Instuctables we will see how to realize a Gameboy Arduino Leonardo.

In fact it is not really a Gameboy but a disguised joystick.

Step 1: First : the Hardware

We will need:

- Arduino Leonardo Arduino IDE +

- 8 Pushbutton

- 8 Resistors

- Cables

- Fine wood lamellas and painting (that is more aesthetic)

Step 2: Step 2 : Decoration !

You are free to do what you want! Unleash your imagination. I preferred to do as below:

Step 3: Step 3 : Connections

After the paint has dried, you should set the push s buttons and make holes in the wood in order to put the wires and resistors.

The connections are about the same as the image below:

Otherwise, you can modify and in the order you want.

Step 4: Step 4: the Code

The code operates on the principle of the function Keyboard.write

You can then edit the code and change the keys as you like.

int A=2;

int B=3;

int Up=4;

int Down=5;

int Left=6;

int Right=7;

int Start=8;

int Select=9;

int led=13;

int AState=0;

int BState=0;

int UpState=0;

int DownState=0;

int LeftState=0;

int RightState=0;

int StartState=0;

int SelectState=0;

void setup(){

pinMode(A,INPUT);

pinMode(B,INPUT);

pinMode(Up,INPUT);

pinMode(Down,INPUT);

pinMode(Left,INPUT);

pinMode(Right,INPUT);

pinMode(Start,INPUT);

pinMode(Select,INPUT);

pinMode(led,OUTPUT);

Keyboard.begin();

}

void loop(){

AState=digitalRead(A);

BState=digitalRead(B);

UpState=digitalRead(Up);

DownState=digitalRead(Down);

LeftState=digitalRead(Left);

RightState=digitalRead(Right);

StartState=digitalRead(Start);

SelectState=digitalRead(Select);

if(AState==HIGH){

Keyboard.write('A');

}

if(BState==HIGH){

Keyboard.write('B');

}

if(UpState==HIGH){

Keyboard.write('Z');

}

if(DownState==HIGH){

Keyboard.write('S');

}

if(LeftState==HIGH){

Keyboard.write('Q');

}

if(RightState==HIGH){

Keyboard.write('D');

}

if(StartState==HIGH){

Keyboard.write('X');

}

if(SelectState==HIGH){

Keyboard.write('C');

}

digitalWrite(led,HIGH);

}

Step 5: ​Step 5: Transfer and Play!

Transfer the code on the Arduino board and now you can play!

http://youtu.be/rPoRScaPpEY