RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    WORKING CONFIG FOR TEENSY LC + SEGA 3 BUTTON PAD

    Scheduled Pinned Locked Moved Projects and Themes
    teensysegamegadrive3 button sega
    1 Posts 1 Posters 740 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mrpromo
      last edited by

      Fully working I added a micro switch to the back of the pad to use as select
      here it is for any one interested

      Change pin numbers as needed

      // player 1 bank
      const int P1_A = 4;
      const int P1_B = 5;
      const int P1_C = 6;
      const int P1_LEFT = 2;
      const int P1_RIGHT = 1;
      const int P1_DOWN = 9;
      const int P1_UP = 8;
      const int P1_SELECT = 10;

      const int START_BUTTON = 7;

      unsigned long lastTime = 0;

      void setup()
      {

      pinMode(P1_A, INPUT_PULLUP);
      pinMode(P1_B, INPUT_PULLUP);
      pinMode(P1_C, INPUT_PULLUP);
      pinMode(P1_LEFT, INPUT_PULLUP);
      pinMode(P1_RIGHT, INPUT_PULLUP);
      pinMode(P1_DOWN, INPUT_PULLUP);
      pinMode(P1_UP, INPUT_PULLUP);
      pinMode(START_BUTTON, INPUT_PULLUP);
      pinMode(P1_SELECT, INPUT_PULLUP);
      
      lastTime = millis();
      

      }

      void loop()
      {
      unsigned long time = millis();
      // run at 50 Hz
      if(time - lastTime >= 20)
      {
      lastTime = time;

          // read the data of all our buttons
          // our buttons
         Joystick.button(1, 1 - digitalRead(P1_A));
         Joystick.button(2, 1 - digitalRead(P1_B));
         Joystick.button(3, 1 - digitalRead(P1_C));
         Joystick.button(4, 1 - digitalRead(START_BUTTON));
         Joystick.button(9, 1 - digitalRead(P1_SELECT ));
      
          // also use buttons for the axes cuz unity is a derp
          Joystick.button(5, 1 - digitalRead(P1_UP));
          Joystick.button(6, 1 - digitalRead(P1_RIGHT));
          Joystick.button(7, 1 - digitalRead(P1_DOWN));
          Joystick.button(8, 1 - digitalRead(P1_LEFT));
      
      
      }
      

      }

      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

      Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.