0

I have shift register 74HC595. I added 7 push buttons from Q1-7 and the 8th to ground. On the other side which pin of the register will go to Arduino pin 2? And wich one to the 5v pin?

How can I read one button at a time in the code because on the Arduino it is just 1 pin?

  • my problem is that i have a lot off buttons 16 how can i do it a 4x4 buttons - do you have 7 buttons or 16 buttons? – Nick Gammon Jan 5 '17 at 7:02
0

You cannot. The 74HC595 does not have parallel inputs, such as you would need to read from 7 switches.

You need a parallel-in, serial-out shift register, such as a CD4021B. You can find details on how to use it with an Arduino here

How can I read one button at a time in the code because on the Arduino it is just 1 pin?

Basically you "clock in" the data by toggling a clock line - each toggle presents the next bit, which you read in using your one digital input.

  • Okay , my problem is that i have a lot off buttons 16 how can i do it a 4x4 buttons with there values to send them to windows form – Project Jan 4 '17 at 21:41
  • And does it work with just the arduino pins? – Project Jan 4 '17 at 21:42
  • How many unused digital pins do you have on your Arduino? – Mark Smith Jan 4 '17 at 21:48
  • I think i just need the grnd and the 5v , i dont have anything attached to the arduino just the buttons , my goal is to play a game i created with those buttons – Project Jan 4 '17 at 21:51
  • If you post another question, asking how to connect 8 switches to an Arduino, I'll answer it - since it's a different question and this one has already been answered. – Mark Smith Jan 4 '17 at 21:56
0

A shift register is an output device. You won't be able to "Read" 7 push buttons in this way.

A shift register like that is for taking a "series" of bits on one wire and parallelizing them onto 8 wires.

It does not work in reverse. The reverse is called a multiplexer.

  • so using this shift register can i send data from C# to arduino code as bytes ? I just want to compare values on my C# with values given when i press a button . – Project Jan 4 '17 at 21:55
  • That's nonsense, jose. See my answer re types of shift registers. – James Waldby - jwpat7 Jan 4 '17 at 23:42
0

Shift registers are available in several flavors:

Serial-in, Serial-out (SISO) units like 7491 have serial input and output.

Serial-in, parallel-out (SIPO) units like 74164 have serial input, parallel output.

Parallel-in, Serial-out (PISO) units like 74165 or 74166 (etc. – just search for shift register in a list of 7400 series integrated circuits or other series) have parallel input, serial output.

Other variations: The 7494, 7495, and 7499 have serial and parallel input, parallel output. The 7499 also has serial output. The 7494 and 7499 can shift right or left. (Most of the models listed earlier only shift one direction.)

Anyhow, by using an appropriate shift register, along with a bunch of resistors and diodes, it is possible to read lots of switches. As suggested in another answer, you might want to ask about how to do that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.