I am using one of the pre-existing libraries for SNES controllers connecting to my arduino Nano and Uno.
Not sure if it is important to state which one.
It has worked with every SNES controller I've thrown at it, so I am happy with it.
But when there is no controller attached, then the arduino will actually "see" random data coming in because my code will do things when thing there is no controller attached, so there is no buttons being pressed.
I am not familiar with shift registers in general, and certainly know nothing about the SNES controllers themselves, but is it possible to add a 1K (or 5K) pulldown resistor to the Data pin to keep it low, so I can eliminate these random events?
Please follow @Railroader's suggestions. Without a schematic, the best I can do is take a SWAG and suggest adding a 10K pull-down resistor on the MISO line. This should reduce noise, and you should see all zeros being read.
The issue is likely that the master keeps trying to read from the slave, and any garbage or noise on the data line is being interpreted as data. Adding the pull-down resistor should stabilize the line when no data is being transmitted.
#include <SNESpad.h>
// Pin numbering for UNO (and NANO)
// put your own strobe/clock/data pin numbers here -- see the pinout in readme.txt
SNESpad nintendo = SNESpad(10,11,12);
When my code checks the state of the controller when it is connected, then all the button presses are detected and I do what I do with them.
When my code checks the state of the controller when it is NOT connected, so an empty SNES socket, then there seems to be random data seen by the arduino because my code
will randomly indicate a random button is pressed.
So I am curious if I can add a pulldown resistor on to the Data pin, to confirm that the pin is always at 0 unless it is driven by the data out of the actual shift register in the SNES controller.
If you can't read and understand from the posted code that the SNES socket is connected to Clock=11, Strobe-10, Data=12, and that's all there is connected, except PWR and GND, then I can't help you either.
If I had the ability to draw a fancy schematic, then I would have, but seeing that there are only three lines, and only one in question (the Data pin), then sorry.
Sorry, but there are many devices that have those pin numbers. If you're assuming they are from the Nano, what exactly are they connected to? You've kept this information a mystery—why?
If you're referencing the SNES, here is its schematic. Can you clarify where the shift register is located? Providing more details will help us assist you better!
I am stepping out of this discussion, as I do not have the time to keep going in circles. There are many others I can assist more effectively. It’s clear that you haven’t read the link provided by @Railroader at the start. Please also understand that we cannot see your setup, and many of us may not have access to the specific parts you’re using.
But really, for my question, does it really matter if the shift register that I am connecting to is inside a SNES controller, or just a shift register IC on a breadboard?
And forget that question because technically, my question is not about that shift register inside the SNES gamepad as I am seeing random data when there is nothing connected to the Nano, so the Nano is seeing noise some from somewhere, so I am just inquiring if a pulldown resistor on the Data pin (pin 12) will eliminate this.
So really at this point there is nothing connected to the Nano, except forthe SNES extension cable (no gamepad attached) and yet there is data being seen.