• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
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

Atari 2600 difficulty toggles on raspberry Pi gpio

Scheduled Pinned Locked Moved Help and Support
atari2600gpio
10 Posts 3 Posters 2.2k 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
    suaveant
    last edited by suaveant 27 Jul 2017, 20:43

    I'm converting an old Atari 2600 (dead) into a game box and I was wondering if anyone has already come up with a way to make the toggle switches work for the difficulty settings.

    I have an idea which involves a wrapper around Stella that reads the gpio on startup and calls the emulator with the proper command line options then sends key presses any time a change is detected but maybe someone has already done the work? So far I haven't been able to find anything.

    H E 3 Replies Last reply 27 Jul 2017, 23:53 Reply Quote 0
    • H
      herb_fargus administrators @suaveant
      last edited by 27 Jul 2017, 23:53

      @suaveant the idea sounds right proper. If it can't be handled in code in sure a microcontroller/Arduino could probably help with the toggle switch. I haven't really done anything hardware wise but I do know anything is possible with enough motivation ;) the configs are easy enough, it's the hardware integration that will probably be the difficult part.

      If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

      Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

      1 Reply Last reply Reply Quote 0
      • E
        edmaul69 @suaveant
        last edited by edmaul69 28 Jul 2017, 09:07

        @suaveant i have a friend who has already done this and created a python script. It works in stella, but im not sure if he got it working in lr-stella. For some reason retroarch has (or at least had) issues with some gpio keyboard functions. I will contact him to get all the info and the python script.

        1 Reply Last reply Reply Quote 1
        • E
          edmaul69 @suaveant
          last edited by 28 Jul 2017, 17:15

          @suaveant so my buddy is going to give me the script and instructions in a few days. He lives in the u.s. but he is in tokyo at the moment.

          S 1 Reply Last reply 28 Jul 2017, 20:58 Reply Quote 1
          • S
            suaveant @edmaul69
            last edited by 28 Jul 2017, 20:58

            @edmaul69 Thanks

            E 2 Replies Last reply 2 Aug 2017, 07:19 Reply Quote 0
            • E
              edmaul69 @suaveant
              last edited by edmaul69 8 Feb 2017, 08:26 2 Aug 2017, 07:19

              @suaveant i dont have python install instruction yet but if you can figure it out this python script is new and needs to be tested. Here is also the info on what each gpio pin does:

              GPIO19 = Color/B&W
              GPIO16 = Left Difficulty
              GPIO20 = Right Difficulty
              GPIO21 = Reset
              GPIO26 = Select

              Sending ground to 16 or 20 would change the status to B.

              Sending ground to 19 would change it to B&W

              So you need to ensure that these three switches are wired correctly.

              Pressing both Reset and Select should send the CTRL-Q combo for exit.

              And here is the script:

              click here

              Key configuration is listed at top of script

              1 Reply Last reply Reply Quote 0
              • E
                edmaul69
                last edited by 2 Aug 2017, 07:38

                For the installation from the terminal do this stuff to get everything installed:

                1. Update (the update may take some time, especially if you have a slow connection):
                  $ sudo apt-get update

                2. Install Python and pip (this will install Python 2 and Python 3, and PIP):
                  $ sudo apt-get install python{,3}-pip

                3. Install gpiozero – this is the Python gpiozero support used in the script for monitoring the buttons:
                  $ sudo apt-get install python-gpiozero

                4. Install uinput – Python keyboard press support used in the script:
                  $ sudo pip install python-uinput

                Once this stuff is installed, then you will be ready for the script.

                1 Reply Last reply Reply Quote 0
                • E
                  edmaul69 @suaveant
                  last edited by edmaul69 8 Feb 2017, 09:01 2 Aug 2017, 07:58

                  @suaveant please note the images were made for a different script so make sure you use atarigpio.py

                  Here is the script and notes on installation and testing

                  I couldn't post a Python file, so create a text file and rename it atarigpio. Put the info from pastebin that i posted. You need to make sure the file extension is .py

                  Copy the script into the /home/pi folder
                  place python file in the home-pi folder.jpg

                  Now you can go to the terminal and test it. Please note that if you are using a Putty terminal, it may not work right. You will need to do it directly with a monitor and keyboard on the Pi.

                  In the terminal, you run the script, sudo python Atarigpio.py and when you press the buttons, then you should see the correct output. When you are done testing, you can press Ctrl-C to stop the script.
                  manually test in terminal.jpg

                  If the script doesn't run, let me know the error, but it typically means that either Python, or gpiozero, or uinput, wasn't installed properly.

                  If the script does run and you can see the button outputs, then we can get it to load during boot.

                  Locate the rc.local file in the /etc/ folder
                  find rc.local.jpg

                  alt text

                  Modify the rc.local with the command line to run the script: python home/pi/Atarigpio.py &
                  modify rc.local to run script.jpg

                  alt text

                  Adding the & (ampersand) at the end tells it to run in the background, so that is important to add that. Otherwise the booting process will seemingly stop with a black screen as your script will be running in the foreground.

                  Reboot and now the script should be running automatically. Please note that you need to give 0777 permissions to the script.

                  So after reboot, go back to the terminal and press your buttons and you should see them working. These should now appear directly on the command line.
                  test after boot.jpg

                  S 1 Reply Last reply 4 Aug 2017, 19:55 Reply Quote 0
                  • S
                    suaveant @edmaul69
                    last edited by 4 Aug 2017, 19:55

                    @edmaul69 Thanks!

                    E 1 Reply Last reply 4 Aug 2017, 20:19 Reply Quote 0
                    • E
                      edmaul69 @suaveant
                      last edited by 4 Aug 2017, 20:19

                      @suaveant yup. Let me know if it all works or if there are any issues. They use stellas default keys.

                      1 Reply Last reply Reply Quote 0
                      10 out of 10
                      • First post
                        10/10
                        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.

                        This community forum collects and processes your personal information.
                        consent.not_received