RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Teensy 4.0 registering multiple devices on RPI5

    Scheduled Pinned Locked Moved Help and Support
    teensyemulationstatonretropie
    4 Posts 2 Posters 330 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.
    • S
      Soybeans
      last edited by

      I have a raspberry pi 5 with pi OS installed and I use a Teensy 4.0 to convert my buttons to a USB gamepad that can be detected, I use emulation station as a frontend and when i configure my controls all digital buttons work expect for joystick. The joysticks are really unresponsive and don't work on the raspberry pi. However, on my computer running Windows 11 it works perfectly.
      Below is my Arduino code it used. Also the USB type I selected for the Teensy was Keyboard + Mouse + Joystick

      void setup() { // pinmode(Actual button on Teensy pin, INPUT_PULLUP)
      Serial.begin(9600);
      pinMode(0, INPUT_PULLUP); // A
      pinMode(1, INPUT_PULLUP); // B
      pinMode(2, INPUT_PULLUP); // X
      pinMode(3, INPUT_PULLUP); // Y
      pinMode(4, INPUT_PULLUP); // D-up
      pinMode(5, INPUT_PULLUP); // D-down
      pinMode(6, INPUT_PULLUP); // D-Left
      pinMode(7, INPUT_PULLUP); // D-right
      pinMode(8, INPUT_PULLUP); // Select
      pinMode(9, INPUT_PULLUP); // Start
      pinMode(10, INPUT_PULLUP); // L
      pinMode(11, INPUT_PULLUP);// R
      pinMode(12, INPUT_PULLUP);// L3
      pinMode(13, INPUT_PULLUP);// R3
      pinMode(14, INPUT_PULLUP);// R3
      pinMode(18, INPUT_PULLUP);// R2
      pinMode(19, INPUT_PULLUP);// L2
      }

      void loop() {
      // read analog inputs and set X-Y position | Joystick.X(analogRead(analog pins 0 - 9))
      Joystick.X(analogRead(2));
      Joystick.Y(analogRead(3));
      Joystick.Z(analogRead(0));
      Joystick.Zrotate(analogRead(1));

      // if (!digitalRead(0) == 1) {
      // digitalWrite(13,1);
      // } else {
      // digitalWrite(13,0);
      // }

      // read the digital inputs and set the buttons
      Joystick.button(1, !digitalRead(0)); // Joystick.button(the button number(its just what you want the button's number to be), !DigitalRead(Button Pin)
      Joystick.button(2, !digitalRead(1));
      Joystick.button(3, !digitalRead(2));
      Joystick.button(4, !digitalRead(3));
      Joystick.button(5, !digitalRead(4));
      Joystick.button(6, !digitalRead(5));
      Joystick.button(7, !digitalRead(6));
      Joystick.button(8, !digitalRead(7));
      Joystick.button(9, !digitalRead(8));
      Joystick.button(10, !digitalRead(9));
      Joystick.button(11, !digitalRead(10));
      Joystick.button(12, !digitalRead(11));
      Joystick.button(13, !digitalRead(12));
      Joystick.button(14, !digitalRead(13));
      Joystick.button(15, !digitalRead(18));
      Joystick.button(16, !digitalRead(19));
      // a brief delay, so this runs 20 times per second
      delay(50);
      }

      1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator
        last edited by mitu

        If the inputs are not registering correctly when testing the input with evtest or jstest, they won't be delivered correctly also to EmulationStation - this is not related to any RetroPie configuration, but it's an OS (Linux) or Arduino issue.

        S 1 Reply Last reply Reply Quote 0
        • S
          Soybeans @mitu
          last edited by

          @mitu i used some of the jstest-gtk commands and i was wondering how can I edit the joystick's deadzone?

          1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator
            last edited by

            You can use jscal to modify the deadzone(s) of an analog joystick, then jscal-store to save the values so they can be applied automatically on boot.

            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.