18 April 2022

Pokemon Platinum Game Controller

Summary

The controller I wanted to make was a Game Controller for Pokémon Platinum. This controller can generally work with any Nintendo DS game though, as it can use the basic inputs on the controller and the d-pad. As I had an Emulator with various Pokémon games on my computer, I decided to make a controller for my favorite game; Pokémon Platinum.

I did not have enough Potentiometers to make a functioning design, so I tested my controller with the only one I had on hand. The goal was to use two potentiometers to send values to the computer through the CPE as they are turned. In order, the commands are sent clockwise, with some "blank areas" to cancel commands/do nothing. One knob would be for movement and the other for using the input buttons.

Overall, I think the idea and code worked very well. Any thoughts on how to improve the functionality? Should I have included something else?

Picture


Code

#include <Adafruit_CircuitPlayground.h>

#include <Adafruit_Circuit_Playground.h>

#include <Keyboard.h>

#include <KeyboardLayout.h>


//Code by Michael Brucato


const int debounce = 100;

const int threshold = 500;


int move = 0;

int input = 0;

int moveInt = 0;

int inputInt = 0;


boolean pressed = false;


void setup() {

  // put your setup code here, to run once:

  CircuitPlayground.begin();


  //turn controller on and off

  pinMode(CPLAY_SLIDESWITCHPIN, INPUT_PULLUP);

  

  Keyboard.begin();

  Serial.begin(4000);

}


void loop() {

  // put your main code here, to run repeatedly:


  //Potentiometer

  move = analogRead(A2);

  input = analogRead(A3);

  moveInt = map(move, 0, 1023, 0, 10);

  input_Int = map(input, 0, 1023, 0, 10);


  //P1, turn left, neutral, and right

 

//Movement Potentiometer


  if(7 < moveInt > 5){

    Keyboard.press(KEY_RIGHT_ARROW);

    delay(100);

    }


  if(10 < moveInt > 8){

    Keyboard.press(KEY_DOWN_ARROW);

    delay(100);

    }

    

  if(5 < moveInt > 3){

    pressed = true;

    Keyboard.press(KEY_UP_ARROW);

    delay(100);

    }


  if(2 < moveInt > 0){

    Keyboard.press(KEY_LEFT_ARROW);

    delay(100);

    }


  if(move == 2 && move == 8){

    Keyboard.releaseAll();

    }


//Input Potentiometer


  if(7 < inputInt > 5){

    Keyboard.write(132);

    delay(100);

      }


  if(10 < inputInt > 8){

    Keyboard.write(130);

    delay(100);

    }

    

  if(5 < inputInt > 3){

    pressed = true;

    Keyboard.write(66);

    delay(100);

    }


  if(2 < inputInt > 0){

    Keyboard.write(65);

    delay(100);

    }


  if(inputInt == 2 && inputInt == 8){

    Keyboard.releaseAll();

    }



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.