20 April 2025

Frogger Game Controller - Group 1

 Description:

This project is a dance-pad style controller revolving around the physical pressure from hands and feet to control the classic arcade game, Frogger. The conceptual model for our controller was built on the idea that the user would sit in a "frog" pose and bounce on the pads to control moving forward throughout the game. The controller itself would be disguised as a lily pad, like the ones in the Frogger game itself and the goal of the game. In a slight twist to the typical D-Pad layout of most dance-pads, our design incorporates only 3, but requires simultaneous input of the two front pads to input a down direction.

The controller is pressure-sensitive, relying on Velostat pads between two parts of aluminum mesh to serve as the conduits. The bottom mesh serves as a universal ground output for each pad. The whole of the logic is put into a simplified box housing the Circuit Playground and plug into the PC to connect the inputs, as well as providing power.

In an early prototype, we had 4 pads for each direction. Initial feedback mentioned how difficult it was to change between each direction, so we went with a combined motion for the down input. This greatly improved the feel of the controller. 

Our mesh affords the controller a great deal of flexibility, while also maintaining a decent level of responsiveness and durability. It also makes it a simple style for younger players and less risk of breaking a traditional keyboard or gamepad. However, this design doesn't afford a clear way to relate each of the inputs and the motions necessary to perform each input. It is also larger than a typical keyboard and requires a bit more body coordination.

Our question is around the visual conveyance of the controller. Specifically, what would be the clearest and affordable way to display the inputs on the pads, without sacrificing the construction and current materials? At the moment, we concede it isn't the most intuitive to explain pressing the top 2 pads to move backward. We would appreciate any feedback on this element.


We ultimately did everything together the main things we did individually was Jacob did the programming and came up with the conceptual design. While Wade took care of getting materials and the blog posts.

CODE:

#include <Adafruit_CircuitPlayground.h>

#include <Adafruit_Circuit_Playground.h>

#include <Keyboard.h>

#include <stdarg.h>

int numberOfButtons = 3;


int input[] = {A1,A2,A3};

//keyboard

//ascii keys (w,a,s,d)



char keys[] = {KEY_UP_ARROW,KEY_LEFT_ARROW,KEY_RIGHT_ARROW,KEY_DOWN_ARROW};



int i = 0;

int vals[3];

int pressure[] {850,850,1000};


int output[] = {3,5,7};


int inputDirections[2];

unsigned long previousBufferMillis = 0;

unsigned long bufferTime = 100UL;


bool bufferIsActive = false;

int currentInput, previousInput;

bool isPressingLeft, isPressingRight;


void setup() {

  Keyboard.begin();

  CircuitPlayground.begin();

  Serial.begin(9600);



    for (i = 0; i < numberOfButtons; i++) 

{

    pinMode(input[i], INPUT_PULLUP);

    pinMode(input[i], HIGH);

    pinMode(output[i], OUTPUT);

  }

}



void loop() {


  if(!CircuitPlayground.slideSwitch())

  {

    Keyboard.release(keys[i]);

    Keyboard.release(keys[3]);

    return;

  }


  for (i = 0; i < numberOfButtons; i++)

  {

    vals[i] = analogRead(input[i]);

    if (vals[i] < pressure[i]){

     if(i == 1)

      {

        isPressingLeft = true;

        bufferIsActive = true;

        previousBufferMillis = millis();

        Serial.println("Left was pressed! Buffer started.");

      }

      else if(i==2)

      {

        isPressingRight = true;

        bufferIsActive = true;

        previousBufferMillis = millis();

        Serial.println("Right was pressed! Buffer started.");

      }



      if(bufferIsActive && isPressingRight && isPressingLeft)

      {

        Serial.println("Down has been activated.");

        Keyboard.press(keys[3]);

        Serial.println("Buffer has been reset.");

        bufferIsActive = false;

        isPressingLeft = false;

        isPressingRight = false;

      }

      else

      {

        Keyboard.press(keys[i]);

        previousBufferMillis = millis();



        Serial.println("Button has been pressed.");

 

      }

    } else {

      Keyboard.release(keys[i]);

      Keyboard.release(keys[3]);

    }

  }



  if(millis() - previousBufferMillis > bufferTime && bufferIsActive)

  {

      isPressingLeft = false;

      isPressingRight = false;

      Serial.println("Buffer has been reset.");

      bufferIsActive = false;

  }

}





No comments:

Post a Comment

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